Microsoft Office Tutorials and References
In Depth Information
Validating Data As It’s Entered
You can test data entered before the validation rule took effect in one of
two ways:
Click the Test Validation Rules button in the Tools group on the Design
tab of the Ribbon.
Display the datasheet by clicking the View button and then click the Yes
button when Access asks whether you want to test existing data.
The Like operator deserves its own explanation. Use the Like operator to
test whether an input matches a certain pattern. Use wildcard characters,
such as the ones shown in Table 5-4, to help define the pattern.
Book II
Chapter 5
Table 5-4
Using the Like Operator
What It Signifies
Any single character
Any single number
Zero or more characters
You may define a zip-code field to allow only five digits, as follows:
Like “#####”
You can also define a field to contain only names that start with the letter S,
as follows:
Like “S*”
According to the preceding rule, a person can choose not to type any
characters after S, because the * wildcard allows zero or more characters. If you
always want a certain number of characters to follow S, use the ? wildcard
instead. If you want users to type exactly three characters after S, use this
validation rule:
LIKE “S???”
You can use more than one expression in a validation rule by separating the
expressions with AND, OR, or NOT. AND and NOT limit the entries that pass the
rule. In the case of AND, an entry must pass both rules; in the case of NOT, an
entry must pass one rule and fail the other. Using OR increases the likelihood
that an entry will pass the rule, because the entry needs to pass only one of
the two rules separated by OR.
Search JabSto ::

Custom Search