data validation in new records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This must be very basic, but this is my first Access project. Why is data validation not performed on a new (tentitive) record? If I edit an exisitng record the validation, such as REQUIRED is enforced as soon as I exit the field. But when appending a new record I can tab around the record (either in table view or form view) and the rule is not enforced until I save the record. The logical place to enforce data validation is when entering new data in a field. What am I missing?
 
Dan

If you wish to test each control as you exit it, you'll need to add your
testing code to the AfterUpdate event of each control.
 
Not really. Sometimes, we use the multiple-Field validation, i.e. a
validation rule that involves values from 2 or more Fields and entering a
value in one Field should not activate the validation check. Thus, the only
appropriate place (for DatasheetView of the Table) is when the Record is
written into the Table.

If you use Form to enter data, you can use VBA code in the
Control_BeforeUpdate to validate the value prior to the Table validation
that occurs when the Record is written into the Table.

--
HTH
Van T. Dinh
MVP (Access)



Dan said:
This must be very basic, but this is my first Access project. Why is data
validation not performed on a new (tentitive) record? If I edit an exisitng
record the validation, such as REQUIRED is enforced as soon as I exit the
field. But when appending a new record I can tab around the record (either
in table view or form view) and the rule is not enforced until I save the
record. The logical place to enforce data validation is when entering new
data in a field. What am I missing?
 
Van

Oooh, I like your approach better. With the BeforeUpdate event, a wrong
value doesn't even get fully entered. I was only considering after tabbing
into the next control...

Thanks!

Jeff Boyce
<Access MVP>
 
Back
Top