| re: Total Hour Duration Query
Stephen,
As I said: "Calculate the timedifference in *minutes*, add these minutes and then
recalculate the hours."
What you do is unfortunately NOT correct ...
When the Sum of the minutes you count this way exceeds 60 then what ?
*First* you need to calculate and sum the minutes. *After* you format to hours and
minutes.
I understand you want to add the timedifference of several records?
Call a field TimeDiffInMinutes. TimeDiffInMinutes:
DateDiff("n",[tblExceptions].[timeOn],[tblExceptions].[timeOff])
Make a GroupBy query and Sum this field.
For display you can use a second query based on the first where you can do:
Duration This Month: CDate(TimeDiffInMinutes\60 & ":" & TimeDiffInMinutes mod 60)
This way you can also sort on TimeDiffInMinutes, which is what you say you want.
--
Hope this helps
Arno R
"Stephen" <stephen.young@cwcom.co.uk> schreef in bericht
news:1109178207.635064.66520@f14g2000cwb.googlegro ups.com...[color=blue]
> Thanks for the reply, managed to get it working using what you
> suggested and the final expression in the query is
>
> Duration This Month:
> Sum(DateDiff("h",[tblExceptions].[timeOn],[tblExceptions].[timeOff])) &
> ":" &
> Sum(DateDiff("n",[tblExceptions].[timeOn],[tblExceptions].[timeOff])
> Mod 60)
>
> which shows the time and is roughly accurate however for a four minute
> duration it would show 0:4 and im not able to sort by duration, is
> there a way to show it neatly as HH:MM and let access recognise this as
> a time but display hour totals greater than 23:59
>[/color] |