End Time and Start Time Message Box

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
 
R

Rick Brandt

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.
 
J

Joe Voll

:

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top