How do I calculate the total hours between two time controls

G

Guest

I am constructing a report in an Acess 2002 Database that requires the
calculation of time. I have a start time and and end time in twelve hour
format (Medium Time), and I want to calculate the total hours. At this point
the expression =[EndTime] - [StartTime] returns and "error." Can you suggest
an experssion that will return the correct result
 
R

Rick Brandt

FrnkRock said:
I am constructing a report in an Acess 2002 Database that requires the
calculation of time. I have a start time and and end time in twelve
hour format (Medium Time), and I want to calculate the total hours.
At this point the expression =[EndTime] - [StartTime] returns and
"error." Can you suggest an experssion that will return the correct
result

Check Help file on DateDiff() function.

Hint: DateDiff returns "boundaries crossed" so...

DateDiff("h", #1:59:59#, #2:00:00#)

....returns 1 even though there is only one second difference. This means
you often have to use the interval that is one smaller than the the interval
you care about and do some division to get the desired results.
 

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