Time to and then from Midnight

  • Thread starter Chris B via AccessMonster.com
  • Start date
C

Chris B via AccessMonster.com

Thanks to previous help I got this far

I have database with fields for depart time, return time, total hours,
regular time and overtime also an overtime only option box that when selected
places a 0 in the regular field and total hours become the overtime hours.
All times are entered YY/MM/DD HH.NN

The probelm at this stage is if the depart date and return date are the same
(with different time) it show a negative number in the overtime field and and
incorrect number in the regular hours field.Problems also exist if there are
a few days difference between depart and return.
All seems to work perfectly when there is 24-48 hours difference between the
times.

With previous help I created a MidNight text box(not visible) with a MidNight
expression
=DateSerial(Year([returntime]),Month([returntime]),Day([returntime]))

Total Hours
=DateDiff("n",[departtime],[returntime])/60

Regular hours called [hrs within call]
=(IIf([Option28]=False,[TotHrs]-[hrsoutsidecall],0))

Overtime is called [hrs out side call]
=(IIf([Option28]=False,DateDiff("n",[MidNight],[returntime])/60,[TotHrs]))

And the overtime Option Box to make all times overtime = Option28

What I would like is that if a depart date is entered and is on the same day
as the return day, only the regular hours should reflect in the regular hours
field and a 0 for overtime because the person has not yet passed midnight.
Also if there are a couple days difference then only the hours going to
midnight on the first (depart) day should reflect and all of the balance of
hours should reflect as over time.
Im sure this sounds a weird thing to achieve, but your help in is most
appreciated!
 
D

Douglas J. Steele

Would using the DateValue function help? It sounds like you want to check
where DateValue([departtime]) equals DateValue([returntime])
 

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