Night shift

sven2

Registered User.
Local time
Today, 09:10
Joined
Apr 28, 2007
Messages
297
Hello,

I want to check for particular users if they have made some new records.
I have found some code that is working during the day ... like

If DateValue(Me.txtnamiddagploegpm7) = Date Then
If TimeValue(Me.txtnamiddagploegpm7.Text) > TimeValue("14:00:00") And TimeValue(Me.txtnamiddagploegpm7.Text) < TimeValue("22:00:00") Then ...

How can I change this for the night shift? Night shift is working from 22:00:01 until 06:00:00 the next day.

Thanks in advance,
Sven.
 
See this MSKB article http://support.microsoft.com/kb/q130514/ describing how Access stores dates/times.

Assuming three 8-hour shifts (06:00 - 13:59, 14:00 - 21:59, 22:00 - 05:59)

x = timevalue(your date/time)
? switch(x<0.25, 1, x<0.583333, 2, x<0.916666, 3, True, 1)


Where 0.25 = #06:00#, 0.58333 = #14:00#, 0.916666 = #22:00#

Switch the numbers (1,2,3) around to reflect your situation then test with various date/times.

HTH - Bob
 
Last edited:

Users who are viewing this thread

Back
Top Bottom