Declarations:
'(None)Code:
Public Function InRange(startTime As Date, endTime As Date) As Boolean Dim dtNow As Date dtNow = Now Select Case TimeValue(dtNow) Case Is > TimeValue(startTime) If TimeValue(endTime) > TimeValue(dtNow) Then InRange = True End If Case Is > TimeValue(startTime) If TimeValue(endTime) > TimeValue(dtNow) Then InRange = True Else InRange = False End If Case Is < TimeValue(startTime) And (TimeValue(endTime) > TimeValue(dtNow)) InRange = True Case Else InRange = False End Select End Function Private Sub Form_Load() Debug.Print InRange(CDate("03:00:00"), CDate("18:00:00")) End Sub
No comments:
Post a Comment