Setting Time Parameters

Erik

Registered User.
Local time
Today, 15:28
Joined
May 16, 2000
Messages
19
I want to determine the time of day when a user to the database I am developing logs on. If the time is between 07:30 abd 15:30 the database will know that this is the "First" shift and make a note in the data record that is in view. But I am having trouble writing the correct conditional code. I thought that I could simply use something like this:

If (Now() >= 730 < 1530) Then

Forms!BackScreenF!Shift = "First"

ElseIf (Now() >= 1530 < 2330) Then

Forms!BackScreenF!Shift = "Second"

ElseIf (Now() >= 2330 < 730) Then

Forms!BackScreenF!Shift = "Third"

But this is not working as I thought it would, because this code returns any time of the day as the first instance giving the the result as the "First" shift. Does anyone have experience in trying to run this type of condition or expression?

Thanks .... Erik Cross
 
for starters...change Now() to Time().

Now() returns Date and Time...

think you also need an AND in your expression...something like...

If (Time()>= 730) And (Time()<1530) Then

also make sure your regional settings are using mil. time (24hr)

hth,
al



[This message has been edited by pcs (edited 12-09-2001).]
 

Users who are viewing this thread

Back
Top Bottom