There are two basic ways that you can require a value in a field:
What do you want to do?
Set the Required property for a field to Yes
- In the Navigation Pane, right-click the table and then click Design View.
- Select the field that you want to require always has a value.
- In the Field Properties pane, on the General tab, set the Required property to Yes.
Note If you set the Required property to Yes for a field in a table that already contains records, Access gives you the option of checking whether the field has a value in all existing records. Regardless of whether you accept this option, new records will require a value for the field.
Top of Page
Create a non-null index for a field by using a data-definition query
- On the Create tab, in the Other group, click Query Design.
- On the Design tab, in the Results group, click the arrow under View, and then click SQL View.
- Delete all the SQL from the query.
- Type or paste the following SQL into the query:
ON () WITH DISALLOW NULL
- In the SQL, replace the variables as follows:
Save and close the query.
Run the query to create the index. Note that you can run the query from a macro by using the RunSQL macro action. For more information, see the See Also section.
- Replace with a name for your index. It is a good idea to use a name that helps you determine what the index is for. For example, if the index is to make sure that social security numbers exist for every record, you might name it require_SSN.
- Replace with the name of the table that contains the field to be indexed. If the table name has spaces or special characters, you must enclose the name in square brackets.
- Replace with the name of the field to be indexed. If the field name has spaces or special characters, you must enclose the name in square brackets.
Top of Page