Date/Time Calculation past midnight...help - Microsoft Access

R

Robert Molina

Im a beginner with Access 2007. I have a report where I need to
calculate elapsed time in hh:mm between "Start Time" and "End Time"
=[End Time]-[Start Time].
The problem occurs during the 3rd shift when entering start times
before midnight and end times after midnight. (this is a machining
report)
Im only capturing Time and not date/time because in manufacturing the
third shift reports all their production to previous day when their
shift began.

I cant use the DateDiff for reason above.
 
R

Rob Parker

Date/time fields actually hold a number, where the integer portion
represents the date as days since 30/12/1899, and the decimal portion
represents the time as portion of 24 hours (eg. .5 is 12 hours). If you're
only storing the time component, the date component is 0. What you need to
do, when End Time is less than Start Time, is to add a day to the End Time.
So you can set the controlsource for your elapsed time textbox to the
following expression:
=IIf([End Time]>[Start Time],[End Time]-[Start Time],([End Time]+1)-[Start
Time])

HTH,

Rob
 

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