Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Times in Access

Status
Not open for further replies.

Alanclyde

Technical User
Jun 5, 2009
22
0
0
GB
I have a database which is holding time in and time out fields.

I can create a query that lets me create a calculation between these two fields, [timeout]-timein] however, I want a cumulative of those times.

An example might be:

TimeIn TimeOut
04:15:00 08:45:00
04:15:00 09:15:00
04:15:00 12:15:00
04:20:00 09:20:00
04:20:00 10:20:00
17:00:00 20:00:00
19:00:00 22:30:00

I can then add a new column for total:

TimeIn TimeOut total
04:15:00 08:45:00 04:30
04:15:00 09:15:00 05:00
04:15:00 12:15:00 08:00
04:20:00 09:20:00 05:00
04:20:00 10:20:00 06:00
17:00:00 20:00:00 03:00
19:00:00 22:30:00 03:30

This is fine, however I want to sum the total column to give me an overall total for this TOTAL field

 
A starting point:
SELECT (24*Int(Sum(TimeOut-TimeIn))+Format(Sum(TimeOut-TimeIn),'h')) & Format(Sum(TimeOut-TimeIn),':nn:ss') AS TotalTime
, Int(Sum(TimeOut-TimeIn)) & " days, " & Format(Sum(TimeOut-TimeIn)," H \hour\s, N \mi\nute\s") AS TotalTime2
FROM yourTable;


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top