Subtracting Time

D

DS

How do you subtract time on a report? Sometimes it goes over midnight,
Sometimes its for several days. I would need total hours and minutes
worked in decimals.
Thanks
DS
 
K

Ken Snell [MVP]

If you're storing date and time, use the DateDiff function. Get the elapsed
time in minutes, and then convert to hours and minutes. Info about DateDiff
is in Help file.
 
D

DS

Ken said:
If you're storing date and time, use the DateDiff function. Get the elapsed
time in minutes, and then convert to hours and minutes. Info about DateDiff
is in Help file.
I tried it and I keep getting a Syntax error, It says Comma.


DateDiff("h",[Date In],[Date Out])

Any suggestion on what might be wrong?
Thanks
DS
 
K

Ken Snell [MVP]

Where are using this expression? If in a control source of a textbox:
=DateDiff("h",[Date In],[Date Out])


--

Ken Snell
<MS ACCESS MVP>

DS said:
Ken said:
If you're storing date and time, use the DateDiff function. Get the elapsed
time in minutes, and then convert to hours and minutes. Info about DateDiff
is in Help file.
I tried it and I keep getting a Syntax error, It says Comma.


DateDiff("h",[Date In],[Date Out])

Any suggestion on what might be wrong?
Thanks
DS
 
D

Douglas J. Steele

Another possibility is that the user's Regional Settings may require
semi-colons instead of commas in the DateDiff function:

DateDiff("h";[Date In];[Date Out]) or =DateDiff("h";[Date In];[Date Out])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Ken Snell said:
Where are using this expression? If in a control source of a textbox:
=DateDiff("h",[Date In],[Date Out])


--

Ken Snell
<MS ACCESS MVP>

DS said:
Ken said:
If you're storing date and time, use the DateDiff function. Get the elapsed
time in minutes, and then convert to hours and minutes. Info about DateDiff
is in Help file.
I tried it and I keep getting a Syntax error, It says Comma.


DateDiff("h",[Date In],[Date Out])

Any suggestion on what might be wrong?
Thanks
DS
 
D

DS

Ken said:
Where are using this expression? If in a control source of a textbox:
=DateDiff("h",[Date In],[Date Out])
Ken got it to work, I deleted the text box and rebuilt a new one then
it worked fine, go figure?
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top