Validation Rule Examples
Validation Rule Examples
The following table provides examples of field-level and record-level validation rules, plus
explanatory validation text. You can adapt these examples to fit your content.
This rule is applied when you enter data into the field. You cannot tab to the next field until you
enter something that satisfies the rule, or undo your entry.
Examples:
Validation Rule
To do this ... Explanation
for Fields
Accept letters Is Null OR Not Any character outside the range A to Z is rejected. (Case
(a - z) only Like "*[!a-z]*" insensitive.)
Accept digits (0 Is Null OR Not Any character outside the range 0 to 9 is rejected. (Decimal
- 9) only Like "*[!0-9]*" point and negative sign rejected.)
Exactly 8 Is Null OR Like
The question mark stands for one character.
characters "????????"
Is Null OR
Between 1000 For Number fields.
Exactly 4 digits And 9999
Is Null OR Like
For Text fields.
"####"
Positive
Is Null OR >= 0 Remove the "=" if zero is not allowed either.
numbers only
Is Null OR
No more than 100% is 1. Use 0 instead of -1 if negative percentages are not
Between -1 And
100% allowed.
1
Not a future Is Null OR <=
date Date()
You must fill in Same as setting the field's Required property, but lets you
Not Null
Field1 create a custom message (in the Validation Text property.)
Is Null OR "M" It is better to use a lookup table for the list, but this may be
Limit to Or "F" useful for simple choices such as Male/Female.
specific
choices Is Null OR IN (1,
The IN operator may be simpler than several ORs.
2, 4, 8)
The Yes/No field in Access does not support Null as other
Yes/No/Null databases do. To simulate a real Yes/No/Null data type, use
Is Null OR 0 or -1
field a Number field (size Integer) with this rule. (Access uses 0 for
False, and -1 for True.)
In addition to those rules, the following table shows the common arithmetic operators and
provides examples of how you can use them.