End Time and Start Time Message Box

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

I am using time in a query and doing calculations off of
it. To make sure I don't get negative values, I have to
make sure that the form won't allow incorrect times. I
have start time and end time. I tried the following code,
but it didn't work. Any suggestions?

If End_Time < Start_Time Then
MsgBox ("End Time must be after Start time")
Endif
 
bill said:
I am using time in a query and doing calculations off of
it. To make sure I don't get negative values, I have to
make sure that the form won't allow incorrect times. I
have start time and end time. I tried the following code,
but it didn't work. Any suggestions?

If End_Time < Start_Time Then
MsgBox ("End Time must be after Start time")
Endif

Where did you put this code? If these are unbound TextBoxes it's possible that the
code is not treating them as Time values but rather as text. You might need to wrap
the values in a CDate() function for the test to work as expected.
 
:

why don't you just swap both time-values in case end_time is smaller than
start_time ? so end_time is start_time and vice versa... it would make one
more annoying msgbox needless :)

Joe.
 
Back
Top