Sign in with
Sign up | Sign in
Closed

Set Unique Key in MS Access 2013

This Tutorial addresses:
Unlike other database applications such as MS SQL Server, Oracle, etc., MS Access 2013 does not allow users to set the unique key constraint that simply. However you can still do so by following a few simple steps.

Although unique key works exactly the way the primary key does, it has one major difference. Where a primary key does not allow users to enter duplicate values and neither does it accepts the null values, a unique key, on the other hand, does allow the null values. This being said, just like primary key, a unique key also does not allow users to enter duplicate values.

The reason why all database languages accept the null values in the unique key is because of the fact that no 2 two null values are expected to be identical. This means that one null value might be different from the other null value and therefore the chances of having identical null values are nil.

Coming back to MS Access 2013, you can trick the application and create a unique key constraint by setting the field properties of the desired field that you want to set as the unique key. In order to do so you must set the field’s ‘Indexed’ value to ‘Yes (No Duplicates)’. You can also override the default unique key constraint behavior by setting the ‘Required’ value to ‘Yes’ which is set to ‘No’ by default. This somehow makes the field to work as a primary key.

By following the steps given below you can configure the above discussed settings in MS Access 2013:

  1. Log on to the computer using any account.

  2. Ensure that MS Access 2013 is successfully installed on the computer.

  3. Initialize MS Access 2013.

  4. On the opened interface, go to the CREATE tab from the top.

  5. From the displayed options in the ribbon, click Table Design icon from the Tables section.



  6. On the displayed interface, in the center pane, specify the name of the field in the Field Name column.

  7. Set the appropriate data type from the displayed list in the Data Type column.

  8. Ensure that the newly created field is selected.

  9. From the Field Properties section of the field that is selected, set the Required value to Yes from the drop-down list.



  10. Also, from the Indexed drop-down list, set the value to Yes (No Duplicates).



  11. Once done, save the table with the desired name.

  12. Close the table, and if required, close database as well.

    Can't find your answer ? Ask !