Re: Calculating\Displaying Time over 24 hrs
- From: Brian <noemail@xxxxxxxxxxxxx>
- Date: Fri, 21 Mar 2008 08:17:53 -0400
So with this should I input as =[time]\60 & ":" & [time] MOD 60 in my control source?
When I put this in as my control source, it displays 7:28 as 0:9.
Brian
If you assume you decide to keep your time in minutes and the variabe is timemin, but want to show it in hours,
timehrmin = timemin\60 & ":" & timemin MOD 60
I tried that formula in the Immediate Window, using 72 as the accumulated number of minutes
? 72\60 & ":" & 72 MOD 60
1:72
or for 27 hours and 35 minutes (1655 minutes)
? 1655\60 & ":" & 1655 MOD 60
27:35
Larry Linson
Microsoft Office Access MVP
"Brian" <noemail@xxxxxxxxxxxxx> wrote in message
news:200832111830.171583@xxxxxxxxxxx
I have a 2000/2002 Access db that I use to collect and store my exercise time using a form to enter. I wanted to see
a summary of the total time for each exercise so I have a subform that does this. Only issue is that when I go over
24 hrs I get the infamous summing time issue. It would be really easy if Access used the Excel [h]:nn format, but it
doesn't. Why can't this be used in Access, Microsoft?????????????????..anyway I digress.
I have two text boxes, one for the detail called txtTime and one for the Summary called txtTotalTime. txtTime
control source would normally be the data field Time and txtTotalTime is just =Sum([Time]).
However, since it does not add up correctly, I added this code as a Public Function.
===========================================
Public Function TotalTimeDisp(lngTotTime As Long) As String
Dim intHours As Integer Dim intMinutes As Integer
intHours = Int(lngTotTime / 60) intMinutes = lngTotTime Mod (intHours * 60)
TotalTimeDisp = Str(intHours) & ":" & Trim(Format(intMinutes, "00"))
End Function ===============================================
and use =TotalTimeDisp(Datepart("n",[total time])) as the control source for the text box txtTime. My issue is that
I am getting a #Div/0! error in the text box.
I would so like to have an easy resolution for this, but I guess my first question is, what format do I need to store
the time in. They are in Date\Time right now. Do I need to change this to text or a number? Any help would be
appreciated.
Thanks, Brian
.
- Follow-Ups:
- Re: Calculating\Displaying Time over 24 hrs
- From: Rick Brandt
- Re: Calculating\Displaying Time over 24 hrs
- References:
- Calculating\Displaying Time over 24 hrs
- From: Brian
- Re: Calculating\Displaying Time over 24 hrs
- From: Larry Linson
- Calculating\Displaying Time over 24 hrs
- Prev by Date: Read Only Property in Windows XP Getting in the Way of FileCopy
- Next by Date: Re: Calculating\Displaying Time over 24 hrs
- Previous by thread: Re: Calculating\Displaying Time over 24 hrs
- Next by thread: Re: Calculating\Displaying Time over 24 hrs
- Index(es):
Relevant Pages
|