Private Sub Command1_Click()
MsgBox isbetween(#9:00:00 AM#, #8:00:00 AM#, #1:00:00 PM#)
MsgBox isbetween(#7:00:00 PM#, #6:00:00 AM#, #1:00:00 PM#)
End Sub
Function isbetween(ByVal time1 As Date, ByVal time2 As Date, ByVal mytime As Date) As Boolean
isbetween = (time1 < time2 And (time1 <= mytime And time2 >= mytime)) Or ((time1 > time2 And (time1 <= mytime) Or time2 >= mytime))
End Function