How To Set A Primary Key

In this post, we demonstrate a couple of different ways to set the primary key in MS Access.

A Primary Key is defined as “a unique key that can uniquely identify each row in a table”. The actual Key itself can be an auto-generated ID number, a known unique number (such as a social security number) or even a text field. The only constraint is that the data be unique!

So, to set a primary key:

Open up an MS Access table in design view and highlight the ID field (if your table doesn’t have an ID field then create one!). In the Tools group of the ribbon you will see a big key icon with a label “Primary Key”. Click on this button.

How to set a primary key

Another way to add a primary key is to select a row by clicking on it and then right-click and choose the key icon.

How to set a primary key

Both of the above methods will produce the same result and adding primary keys will help your tables to be more robust as a result!

Related Posts

Adding Fields To A Table
Field Data Types
How To Create A New Table In Access
How To Increment A Text ID Field
Indexes

As always, a site wouldn't be anything without its users so please feel free to comment! We welcome any comments you have on the material and any suggestions you may have for future content.


In our humble opinion, it is worth commenting just so you can play with Fun Captcha below!

1 Comment