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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data validation

Status
Not open for further replies.

chimaera

Programmer
Oct 29, 2001
10
US
hi there....

could someone help me on this...

i have 2 date fields a start date and an end date and i need to validate this upon data entry that the start date must be smaller/earlier than the end date...

could this be done in the data validation section of the field...

this may seem as a simple question to u guys out there but i'm relatively new to access and i havent found a solution for this...

hope someone could help me on this..

thanx

regards
Peter
 
hi there,

If the rule always applies, then you can specify a validation rule for the table:

Go into the table design, then goto table properties (View|Properties in menubar), then add your validation rule e.g.
[Start Date] < [End Date]

Cheers,
Dan
 
well, yes, ... but only at the expense of generaing an error which would then need to be handled.


Far better, in my opinion, to just exercise the BeforeUpdate event of the form (or control?) to check the dates' relationship and do the message box notification 'BEFORE' attempting to update the database. MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Yeah, I agree with Michael. Whenever possible, do your validating in the beforeUpdate event of the control on the form. In your validation you'll have to decide what to do about the order in which users enter data, as that will determine how you deal with null values in the other control.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top