"Nigel Heald" <ni***@mrauk.co.ukwrote in
news:12*************@corp.supernews.com:
Hi Folks,
We have a form that records flight times in hours and minutes, for
example a 1 hour 15 minute flight is recorded as 1:15 Does anyone know
how to get Access 2003 to calculate a total figure for a number of
flight times recorded in a datasheet form? and is there a way to
display flight times greater than 24 hours i.e 26:20 for example? The
only solution i can find is to use decimal times i.e 1.25 instead of
1:15 which is our least preferred solution.
Many thanks
Nige
You could write User Defined Functions. Here are a couple, thoroughly
untested, that might be a start:
Sub temp()
Debug.Print TimetoMinutes("1:15") + TimetoMinutes("23:00")
End Sub
Public Function HoursandMinutes$(ByVal vNinutes As Date)
Dim DateZero As Date
Dim Ninutes&
DateZero = DateSerial(1899, 12, 30)
Ninutes = DateDiff("n", DateZero, vNinutes)
HoursandMinutes = CStr(Ninutes \ 60) & ":" & CStr(Ninutes Mod 60)
End Function
Public Function TimetoMinutes#(ByVal vTime$)
' vtime must be in format #0:00
TimetoMinutes = CDbl(Replace(vTime, ":", "."))
End Function