Re: Elapsed Time Assistance
- From: "Duane Hookom" <DuaneAtNoSpanHookomDotNet>
- Date: Sat, 29 Apr 2006 12:18:35 -0500
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
.
- Follow-Ups:
- Re: Elapsed Time Assistance
- From: Hank__Top__Chi
- Re: Elapsed Time Assistance
- References:
- Elapsed Time Assistance
- From: Hank__Top__Chi
- Elapsed Time Assistance
- Prev by Date: Re: Insert records in Parent and child tables
- Next by Date: Re: Elapsed Time Assistance
- Previous by thread: Elapsed Time Assistance
- Next by thread: Re: Elapsed Time Assistance
- Index(es):
Relevant Pages
|
|