Set Unique Key in MS Access 2013

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:

    ■Log on to the computer using any account.

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

    ■Initialize MS Access 2013.

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

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

    yYDB39t.jpg


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

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

    ■Ensure that the newly created field is selected.

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

    ALkYbKk.jpg


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

    6LWrXPp.jpg


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

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

 
Status
Not open for further replies.
Status
Not open for further replies.