How to Use Data Validation in Microsoft Access on Windows 11

Posted on 19th June 2023

Data validation is a process of ensuring that the data entered into a field is correct and complete. It is a critical part of any database application, as it helps to ensure the accuracy and integrity of the data.

Why Use Data Validation?

Data validation is important for two main reasons:

  • To ensure the accuracy of the data: Data validation ensures that the data entered into a field is correct. This is important for both the users of the database and the database itself. For example, if a phone number is entered into a field, the data validation will ensure that only digits are entered and that the correct number of digits is entered. This is important for the users of the database, as it ensures that they are able to input the correct data. It is also important for the database, as it ensures that the data is stored correctly.
  • To ensure the completeness of the data: Data validation also ensures that the data entered into a field is complete. This is important for both the users of the database and the database itself. For example, if a field requires a telephone number, the data validation will ensure that a telephone number is entered. This is important for the users of the database, as it ensures that they are able to input the correct data. It is also important for the database, as it ensures that the data is stored correctly.

How to Use Data Validation in Microsoft Access

Data validation in Microsoft Access is done through the use of the “Data Validation” feature. This feature can be found in the “Access Options” menu.

To access the “Data Validation” feature:

  1. Open Microsoft Access.
  2. Click on the “File” tab.
  3. Click on “Options.”
  4. Click on “Advanced.”
  5. Scroll down to the “General” section.
  6. Click on the “Data Validation” check box.
  7. Click on “OK.”

To use the “Data Validation” feature:

  1. Open the table that you want to validate.
  2. Click on the “Design” tab.
  3. Click on the field that you want to validate.
  4. Click on the “Data” tab.
  5. Click on the “Data Validation” button.
  6. Select the type of validation that you want to use from the “Validation Rule” drop-down list.
  7. Enter the parameters for the validation rule in the “Validation Text” box.
  8. Click on “OK.”

Types of Data Validation

There are four types of data validation:

  • Required field: A required field is a field that must be completed in order for the record to be saved. This is the most basic type of data validation.
  • Format: A format validation rule ensures that the data in the field is in the correct format. For example, a date field may have a format validation rule that ensures that the data is in the format “dd/mm/yyyy”.
  • Range: A range validation rule ensures that the data in the field is within a certain range. For example, a field may have a range validation rule that ensures that the data is between 1 and 10.
  • Custom: A custom validation rule allows you to create your own validation rule. This is the most flexible type of data validation.

Data Validation Parameters

The parameters for data validation vary depending on the type of data validation that you are using.

Required field:

The parameters for a required field are:

  • Field name: The name of the field that you want to make required.
  • Error message: The error message that you want to display if the field is not completed.

Format:

The parameters for a format validation rule are:

  • Field name: The name of the field that you want to validate.
  • Format: The format that you want the data in the field to be in.
  • Error message: The error message that you want to display if the data is not in the correct format.

Range:

The parameters for a range validation rule are:

  • Field name: The name of the field that you want to validate.
  • Minimum value: The minimum value that you want to allow.
  • Maximum value: The maximum value that you want to allow.
  • Error message: The error message that you want to display if the data is not within the specified range.

Custom:

The parameters for a custom validation rule are:

  • Field name: The name of the field that you want to validate.
  • Validation rule: The validation rule that you want to use. This can be any SQL statement.
  • Error message: The error message that you want to display if the data does not meet the validation rule.

Data Validation Examples

Here are some examples of data validation rules:

  • Required field:


    Field name: Phone number

    Error message: Phone number is required

  • Format:


    Field name: Date of birth

    Format: DD/MM/YYYY

    Error message: Date of birth must be in the format DD/MM/YYYY

  • Range:


    Field name: Age

    Minimum value: 18

    Maximum value: 65

    Error message: Age must be between 18 and 65

  • Custom:


    Field name: Email address

    Validation rule: LEN(EMAIL) >= 5 AND EMAIL LIKE '%@%.%'

    Error message: Email address must be a valid email address

Conclusion

Data validation is a critical part of any database application. It helps to ensure the accuracy and completeness of the data. Microsoft Access provides a “Data Validation” feature that can be used to validate the data in a database.