View Full Version : Sum short time


Charley Goddard
06-29-2005, 06:18 AM
I have a problem that my report will not sum correctly the total time values. My table holds the start time and end time in short date format and my query calulates the time elasped.

Length of time: 1+[Time of Departure]-[Time of Arrival]

as the duration of time exceeds 24hrs I am having a problem. Most of the threads that I have read to possibly solve this require the field to hold both the date and time. At current the date is in a seperate field.

Pls Help, this is driving me nutts !!

andrew93
06-30-2005, 12:20 AM
Hi Charley

I'm not sure if this will help but assuming the difference between the arrival time and departure time can not exceed 24 hours, and assuming the arrival time occurs before the departure time (e.g. like in an airport transit lounge), then use the following in your query to work out the difference (in minutes) :

DateDiff("n",[ArrTime],[DepTime])+IIf([ArrTime]>[DepTime],1440,0)

Make sure you use your actual field names where I used 'Arrtime' and 'DepTime'.

If the arrival time occurs after the departure time (I assumed the other way around, but the other way around would be for the time spent travelling), then swap the Arrival & Departure fields around in my expression.

HTH, Andrew :)

Charley Goddard
06-30-2005, 12:38 AM
That worked perfect, thanks