Total Time

S

Sam

I have a query with fields of Start Time and Stop Time and Total Time. What
expression do I use to get the Total Time to calculate the time between Start
and Stop to get the total time?
Thanks!
 
C

Chaim

Depending on the units that you want to use to measure the time difference,
you would use the DateDiff () function.

DateDiff ("<units>", [Start Time], [Stop Time])

(I might have the times backwards) Check out the Access Help > Visual Basic
Language Reference > Functions > D-G > DateDiff for the <units> particulars.

BTW, it iis generally not a good idea to keep data that can be calculated in
a table. It is usually better to simply calculate it as needed.

Good Luck!
 
C

Chris B via AccessMonster.com

Sam,
You can use =DateDiff("n",[Starttime],[Returntime])/60 as the
control source for your [totaltime] text box on your form or report - this
returns the time in Hours and portion of an hour
IE, 1 hour and 30 minutes will be displayed as 1.5
- to limit the amount of numbers to 2 after the decimal point then use
=Format(DateDiff("n",[Starttime],[Stoptime])/60,"0.00")

Hope this helps
 
S

Sam

Yes, this one works!
Thanks!

Chris B via AccessMonster.com said:
Sam,
You can use =DateDiff("n",[Starttime],[Returntime])/60 as the
control source for your [totaltime] text box on your form or report - this
returns the time in Hours and portion of an hour
IE, 1 hour and 30 minutes will be displayed as 1.5
- to limit the amount of numbers to 2 after the decimal point then use
=Format(DateDiff("n",[Starttime],[Stoptime])/60,"0.00")

Hope this helps
I have a query with fields of Start Time and Stop Time and Total Time. What
expression do I use to get the Total Time to calculate the time between Start
and Stop to get the total time?
Thanks!
 
Top