Am new to this forum. Feel like this is a good place to find help and share my knowledge..
I need to find if a given time falls under two predefined time values.
In the following code str1 holds the input from the user. str2 and str3 are preset time values. the if statement is used to compare the time values. But when i input time between 00:00:00 and 6:00:00, the msgbox is not displayed.
Is this the correct approach, if not how do i go about..
Dim str1 As Date, str2 As Date, str3 As Date
str1 = Text1.Text
str2 = TimeValue("00:00:00")
str3 = TimeValue("6:00:00")
if (str1 >= str2) and (str1 <= str3) then
msgbox "Time is within the preset period"
endif
thanks for the help....

New Topic/Question
Reply




MultiQuote




|