A validation rule is an expression that limits the values that can be entered in the field.
Examples of validation rules
List of operators that can be used for validation rules
|Not||Tests for converse values. Use before any comparison operator except IS NOT NULL.||Not > 20|
|In||Value must be in the specified list.||In (“Sussex”,”Surrey”,”Kent”)|
|Between||Value must be in the range specified||Between 0 And 10|
|Like||Use wildcard character * to define the pattern of a valid string value||Like “BN*” – must start with BN|
Like “*BN*” – must contain BN
Like “*BN” – must end with BN
|Is Not Null||Value must be entered in the field. This is the same as setting the Required field property to Yes. The benefit of using a validation rule here is that you can specify validation text which is more user friendly than the default one for the required field property.||Is Not Null|
|And||Specifies that all parts of the validation rule must be true.||>=0 And <=10|
|Or||Value can be any of the values specified||Sussex Or Kent|
|<=||Less than or equal to.|
|>=||Greater than or equal to.|
|<>||Not equal to.|
Testing Validation Rules
You can test validation rules within a table by clicking on the Test Validation Rules button on the Ribbon’s Design tab. This assumes you are in the table’s design view.
Use in conjunction with the validation rule to create an error message that appears when a user enters a prohibited value.
The validation text shown above would appear like this.