Microsoft Office Tutorials and References
In Depth Information
Validating Data As It’s Entered
Figure 5-8:
Use the
property on
the Table
sheet to
establish a
rule for the
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
Price 0 or greater
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
Search JabSto ::

Custom Search