Microsoft Office Tutorials and References
In Depth Information
Validating Data As It’s Entered
Figure 5-8:
Use the
Validation
Rule
property on
the Table
property
sheet to
establish a
rule for the
record.
Book II
Chapter 5
Table 5-2 shows a few examples of validation rules. If you have a
complicated validation rule, read up on creating expressions in Book III. Use
expressions in validation rules the same way that you use them in query
criteria. If the expression is true, the data can be entered; if the expression is
false, the validation text displays, and the data can’t be entered.
Criteria are covered in Book III, Chapter 1, and expressions are covered
in detail in Book III, Chapter 2. The Build button that appears next to the
Validation Rule box when you’re entering a rule displays the Expression
Builder, which is also covered in Book III, Chapter 2.
Table 5-2
Validation-Rule Examples
Rule for the Field
Validation Rule
Date not before 2006
>#12/31/05#
Price 0 or greater
>=0
Five characters beginning with P
Like P????
Ship date equal to or later than
order date
[Ship Date]>=[Order Date]
If a user attempts to enter data that doesn’t pass a validation rule, the
contents of the Validation Text field property pop up to guide the user,
using the text you enter. Generally, the validation text guides the user to
enter the right data. An exception may occur if you don’t want to give away
too much information. Maybe Order numbers are always two letters
followed by three or more numbers, but you don’t want users to guess at an
Order number. Your validation text can simply say Enter a valid Order
number.
Search JabSto ::




Custom Search