Defining primary keys in Microsoft Access 2019

A primary key distinctively identifies each record (row) in thetable. An example of a primary key is CustomerID—this would be a uniquenumber for each customer. This is very similar to an ID number. TheData Type that can be used isAutoNumber, which automatically increments by one each timeso that the user does not have to think up a new number for eachcustomer. Access will also prevent duplicates or null values from beingentered into the primary key field by alerting the user. If you don’tdefine a primary key whilst designing the table, it will prompt you todo so when saving the table.

Records in a table are sorted according to the value in the primarykey field. It is recommended that each table contains a primary key.Primary keys can be based on alphanumeric values as well:

  1. Open the SSGEmployees.accdb database. You will see twobasic tables. Open the Employees tablein Design View to edit the propertiesof the field.
  2. Click on the ID field, thenright-click on the field and choose PrimaryKey or click on the Table ToolsDesign contextual menu, then select Primary Key from the Tools group:
ms office 113

Let’s learn how to set a relationship between two tables using theprimary key.

Leave a Comment