Re: Elapsed Time Assistance



Consider using Doug Steele's function found at
http://www.accessmvp.com/djsteele/Diff2Dates.html
--
Duane Hookom
MS Access MVP

<Hank__Top__Chi@xxxxxxxxxxx> wrote in message
news:OOM4g.77509$dW3.25301@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I found the following article and sample DB.
http://office.microsoft.com/en-au/assistance/HA011102181033.aspx

After importing the module, everything works great. However instead of
just
House:Minutes, I would like to edit the module below to display
Hours:Minutes:Seconds

Could someone be so kind as to show me what to change below.

Thanks,
Hank

Public Function HoursAndMinutes(interval As Variant) As String
'***********************************************************************
' Function HoursAndMinutes(interval As Variant) As String
' Returns time interval formatted as a hours:minutes string
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440)) ' 1440 = 24 hrs * 60 mins
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400)) ' 86400 = 1440 * 60 secs
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours & ":" & Format(minutes, "00")

End Function




.



Relevant Pages

  • Re: Elapsed Time Assistance
    ... Public Function HoursAndMinutes(interval As Variant) As String ... Dim totalminutes As Long, totalseconds As Long ...
    (microsoft.public.access.queries)
  • Re: List Box to Open Form
    ... did you have the procedure in a form's module, and then add it to a standard ... > String it worked really well. ... >>> Public Function HoursAndMinutes(interval As Variant) As String ... >>> Dim totalminutes As Long, ...
    (microsoft.public.access.forms)
  • Time Function
    ... Public Function HoursAndMinutes(interval As Variant) As String ... Dim TotalMinutes As Long, totalseconds As Long ...
    (microsoft.public.access.modulesdaovba)
  • Elapsed Time Assistance
    ... Public Function HoursAndMinutes(interval As Variant) As String ... Dim totalminutes As Long, totalseconds As Long ...
    (microsoft.public.access.queries)
  • Still problems with time
    ... Could somebody please advise of the correct format to query the results from ... Public Function HoursAndMinutesAs String ... Dim totalminutes As Long, totalseconds As Long ...
    (microsoft.public.access.gettingstarted)