Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating input data, when entered 1

Status
Not open for further replies.
Feb 26, 2003
2
0
0
US
I have a form that has a series of fields dealing with date and time and I need to validate that the data entered is correct when the customer leaves the field. I have tried using the format validation rules without success.

The first field is "Class Date" it is defined with a Short Date format. I need to verify that the date entered is less then or equal the current date, when the customer tabs to the next field.

The next four fields are text fields "Start1", "End1", Start2" and "End2". If "Start1" is not blank then "End1" must be filled in and > then "Start1". If "Start2" is not blank then "Start1" and "End1" must have been filled in and "Start2" must be greater then "End1". The same rules apply to "End2" it must be > then "Start2" and "Start1", "End1" and "Start2" must have been completed".
 
A couple of approaches come to mind
1. The one that I like to use the most is to not open fields until they are needed. You walk the user through the window - only allowing them access to what they need.

Set the enabled status of ALL of your date fields but Class Date to Disabled. On the Exit event of the Class date field, check the date to ensure it's less than the current date. If it is, enable Start1 - on exit from it - check to ensure it's a valid date and enable end1.

On exit from end1 - check the rules for start1 and end1 - if it's OK - open up start2, etc.
if it's not - set the focus back to the incorrect entry.

You may want to program all of these checks into a subroutine with a parameter to let it know which condition to check. That way, if the user has entered valid stuff in start1 and end1 and then goes back and changes end1 - you just call the subroutine with a parameter that indicates the user exited start1.

Since you do have a lot of inputs, you may want to write up a CONTROL->Action->Response table to define exaclty what must happen on any event that may occur on any field.

2. The Second approach would be to wait until all inputs are entered and then provid the user with feedback on all their mistakes - but this usually tends to get on a user's nerves.

HTH
Jimmy

 
for the "ClassDAte" field in the Validation Rule Property
<=Date()

Should verify that the date entered is less than or equal to the Computer system date.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top