Error Handling on Date Range

RandomT

Registered User.
Local time
Today, 11:20
Joined
Mar 3, 2009
Messages
10
Dear fellow readers,

I have two comboboxes, one as cboStartTime and the other cboEndTime

How do i notify the user after selecting both controls that cboStartTime is greater than cboEndTime or in other words, if the user inputs 08:30 AM on cboStartTime and 07:20 AM on cboEndTime, i want to notify the user that cboEndTime cannot be less than 08:30 - don't know how else to explain other than greater than and less than..

Thanx in advance,
T
 
create a before update event for each text box.
Then in each event call a function to validate your time and return true or false.

if the time is False (in error) then set cancel = true
Code:
the function should check if both fields are not null, if so the perform your compare
FunctionName = True
   If me!TimeFrom > me!TimeTo Then
      FunctionName=False
   End
 
A more professional approach is to use cascading combo box tricks whereby as soon as they pick a start time the row source in the end time only start where the start time left off. In that way they cannot pick a end time that is before the start time.

David
 
Thank you Dennisk,

Apparently, i'm still learning VB so I cannot create my own function other than just the simple ones so please clarify more on your point

DCrake, I'm using a pop up calendar to choose the date from so i'm not too sure if cascading combo box tricks work for me - should have mentioned it in my first thread..but thanks for your help

T
 

Users who are viewing this thread

Back
Top Bottom