[AccessD] Question on hours

DorisH3 at aol.com DorisH3 at aol.com
Tue Dec 5 16:36:19 CST 2006


Hi,
 
Sorry that I am being such a pest but I didn't know where I should put this  
routine which I assume is Visual Basic.  Does it go in a text box control  on 
the report? I definitely need help with this report....it has to show hours  
and minutes...and then it must sum each volunteers total hours and  minutes.
 
Doris
 
Fn_GetMinutes()
(Computes time elapsed in  minutes)
==============================
Function Fn_GetMinutes(ByVal  TimeStart As Variant, _
ByVal TimeFinish As Variant) As  Single

Fn_GetMinutes = 0     ' Default
If IsDate(TimeStart) And  IsDate(TimeFinish) Then
TimeFinish =  IIf(TimeFinish >= TimeStart, TimeFinish, _
1 +  TimeFinish)
Fn_GetMinutes = (TimeFinish -  TimeStart) * 1440
End If
End  Function
==============================

Fn_FormatMinutes()
(Formats  minutes As Hrs:Mins string)
==============================
Function  Fn_FormatMinutes(ByVal Minutes _
As Variant) As String
Dim Txt As String, Hrs As Long,  Mins As Long

Txt = "00:00"     ' Default
If Minutes > 0 Then
Hrs = Int(Minutes / 60)
Mins =  Minutes Mod 60
Txt = Format(Hrs, "00") & ":"  &  _
Format(Mins,  "00")
End If

ExitPoint:
Fn_FormatMinutes = Txt

End Function




More information about the AccessD mailing list