PC Review


Reply
Thread Tools Rate Thread

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

 
 
Robert Molina
Guest
Posts: n/a
 
      27th Jul 2011
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.

 
Reply With Quote
 
 
 
 
Rob Parker
Guest
Posts: n/a
 
      28th Jul 2011
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


"Robert Molina" <(E-Mail Removed)> wrote in message
news:849c99b5-6285-44c9-a675-(E-Mail Removed)...
> 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.
>


 
Reply With Quote
 
Robert Molina
Guest
Posts: n/a
 
      3rd Aug 2011
On Jul 27, 6:45*pm, "Rob Parker"
<NOSPAMrobppar...@optusnet.com.au.FORME> wrote:
> 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
>
> "Robert Molina" <robertmolin...@gmail.com> wrote in message
>
> news:849c99b5-6285-44c9-a675-(E-Mail Removed)...
>
>
>
> > 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.- Hide quoted text -

>
> - Show quoted text -


SOLVED!!!
Rob, you are the man!
I've googled the heck out of this subject and even looked at forums
for a while and have found zero solutions or help.
Your expression worked perfectly!
Thanks,
Robert.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date/Time Calculation past midnight...help Bec_FS Microsoft Access 3 17th Sep 2008 12:14 PM
Calculating time past midnight. =?Utf-8?B?bWFpbHJhaWw=?= Microsoft Excel Misc 3 18th Apr 2007 07:39 PM
Subtract Time over and past Midnight =?Utf-8?B?QW5keSBTdGVwaGVucw==?= Microsoft Access Forms 2 8th Aug 2006 05:13 AM
Calculating Time Past Midnight =?Utf-8?B?RGFycmVu?= Microsoft Excel Worksheet Functions 6 13th Mar 2006 03:03 PM
Time Calculations past midnight =?Utf-8?B?RGF2ZU4=?= Microsoft Access 2 17th Aug 2005 10:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:45 AM.