Microsoft Office Tutorials and References
In Depth Information
Validating Data As It’s Entered
The validation text can’t be longer than 255 characters.
Use operators to tell Access how to validate your data. Operators are
symbols, (such as < and >) and words (such as AND, OR, and NOT) that tell
Access how to limit your data. (Although +, –, *, and / are also operators,
you aren’t as likely to use them in validation rules.) You can also use
expressions that include functions to create validation rules.
The validation rule can’t be longer than 2,048 characters.
To create a validation rule, follow these steps:
1. Display the table in Design view.
2. Select the field to which you want to add a validation rule.
Place the cursor anywhere in the row that displays the field and data
type, or click the record selector to select the field. When the field is
selected, or when the cursor is anywhere in its row, you see the field
properties for that field.
If you want to create a record validation rule, click the Property Sheet
button on the Design tab of the Ribbon.
3. Click the Validation Rule property.
4. Type your validation rule.
Table 5-3 tells you how to create your validation rule.
5. Enter an explanatory message in the Validation Text property.
Validation text appears when data entered in the field doesn’t meet the
validation rule. In most cases, you want this script to help the user to
understand why the input wasn’t accepted. (In some cases, you may not
want someone to make up data that passes the validation rule, so your
validation text may be more cryptic.)
Creating Validation Rules
How It Works
“Boston” OR “New York”
Limits input in the field to those two cities
Allows values less than 10
Allows values greater than 10
Allows values less than or equal to 10
Allows values greater than or equal to 10
Allows values equal to 10
Allows values not equal to 0
Allows text that is Boston or Concord
Between 10 AND 20
Allows values between 10 and 20