In Access 2002, I'm trying to use a Select Case statement to assign a time of day to a particular shift (numbered 1,2, or 3). Here's a code snippet:
myEnd is a date/time parameter passed to the function. For now, I only care about the time portion.
Select Case FormatDateTime(myEnd, vbLongTime)
Case #8:00:00 AM# To #2:00:00 PM#
EndPeriod = 1
Case #2:00:00 PM# To #8:00:00 PM#
EndPeriod = 2
Case Is > #8:00:00 PM#, Is < #8:00:00 AM#
EndPeriod = 3
End Select
When I send it a time such as 3:00 AM, it satisfies the second Case (2pm-8pm) and sets EndPeriod to 2. It should be setting EndPeriod to 3. Why would the Select case consider 3AM to be between 2PM and 8PM?
thanks.
myEnd is a date/time parameter passed to the function. For now, I only care about the time portion.
Select Case FormatDateTime(myEnd, vbLongTime)
Case #8:00:00 AM# To #2:00:00 PM#
EndPeriod = 1
Case #2:00:00 PM# To #8:00:00 PM#
EndPeriod = 2
Case Is > #8:00:00 PM#, Is < #8:00:00 AM#
EndPeriod = 3
End Select
When I send it a time such as 3:00 AM, it satisfies the second Case (2pm-8pm) and sets EndPeriod to 2. It should be setting EndPeriod to 3. Why would the Select case consider 3AM to be between 2PM and 8PM?
thanks.