Fix the Missing Primary Key Command in Microsoft Access
Question details
The user needs to find the Primary Key command and choose an appropriate primary key for an Access table.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- The user is designing a table and wants to set a field or fields as the primary key.
- Observed behavior
- The Primary Key command is missing from the shortcut menu, potentially because no field is selected or the table is not open in Design view.
Open the database and identify the table you want to edit. Decide whether an existing field has unique values or whether you need a new AutoNumber ID field.
Set the primary key from the Access ribbon
Use Table Design view and the ribbon when the command is missing from the shortcut menu.
In the Navigation Pane, right-click the table and select Design View.
Click the row selector to the left of the field you want to use. To create a composite key, hold Ctrl and select each required field row.
On the Table Design tab of the ribbon, click Primary Key. A key icon should appear beside the selected field or fields.
Click Save on the Quick Access Toolbar or press Ctrl+S. If Access reports duplicate or invalid values, correct them before saving the key.

Create an AutoNumber primary key
Add a surrogate ID when the table does not have a suitable unique field.
Enforce unique name combinations with an index
Use a unique composite index when your rules require each first-and-last-name combination to be distinct, while keeping an ID primary key.
Use WPS Office for Everyday Document and Spreadsheet Work
WPS Office is a free, lightweight alternative with a familiar interface and compatibility with common Microsoft Office formats, making it easy to move everyday documents and spreadsheets. It does not replace Access or fix Access database commands.

Frequently Asked Questions
Where is the Primary Key button in Access?
Open the table in Design View, select a field row, and click Primary Key on the Table Design ribbon.
Why is Primary Key missing from the right-click menu?
The table may not be in Design view, or no field row may be selected. Open Design View and select the row selector beside a field, then use the ribbon button.
Can I use first and last names as a primary key?
A composite key is possible, but names can be duplicated and are usually a poor choice. Consider an AutoNumber ID instead, and add a unique index on the name fields only if your rules require distinct combinations.
Why won't Access save my primary key?
A primary key must uniquely identify each record and cannot contain null values. Check the selected fields for duplicates or missing values, and ensure their data types are suitable for a key.




