Question : Cumulative Time that totals beyond 24 hours.

I have been tasked with creating a database that will track cumulative running time.  For example, we recieve an aircraft that has 14 hours 34 min 26 sec of elapsed flying time since new.  Each day the aircraft flies, it adds more elapsed flying time to the previous total.  Summing time in Access does not seem to be a problem until you reach the 24 hour "barrier".  I have found no way to get Access to calculate beyond this (e.g 23:30:00 plus 2:30:00 = 26:00:00)  In excel this is possible by formatting the applicable cells as "[h]:mm" where [h] tells excel to calculate beyond the 24 hour period.

We have been using an excel spreadsheet for tracking aircraft flying times, but this is a poor way to do it if you have sub components on that aircraft that you need to 'time track' as well.

Any assistance as to how to calculate beyond the 24 hour limit in Access is greatly appreciated.

Answer : Cumulative Time that totals beyond 24 hours.

the entry to the table should be in the format   i.e., 14:34:26,
to include the seconds here is a revised version

the tablename is TimeCard with a field  Daily Hours.

Function GetFlightTimeTotal()

 Dim db As DAO.Database, rs As DAO.Recordset
 Dim totalhours As Long, totalminutes As Long
 Dim days As Long, hours As Long, minutes As Long
 Dim interval As Variant, j As Integer

 Set db = DBEngine.Workspaces(0).Databases(0)
 Set rs = db.OpenRecordset("timecard")
 interval = #12:00:00 AM#
    While Not rs.EOF
       interval = interval + rs![Daily hours]
       rs.MoveNext
    Wend
 totalhours = Int(CSng(interval * 24))
 totalminutes = Int(CSng(interval * 1440))
 totalseconds = Int(CSng(interval * 86400))
 hours = totalhours Mod 24
 minutes = totalminutes Mod 60
 Seconds = totalseconds Mod 60

 GetFlightTimeTotal = totalhours & " hours and " & minutes & " minutes " & Seconds & " seconds"

 End Function
Random Solutions  
 
programming4us programming4us