MS-Access / Getting Started

Defining a Primary Key

Every table in a relational database should have a primary key. Telling Access 2010 how to define the primary key is quite simple. Open the table in Design view and click the row selector to the left of the field you want to use as the primary key. If you need to select multiple fields for your primary key, hold down the Ctrl key and click the row selector of each additional field that you need.

After you select all the fields you want for the primary key, click the Primary Key button in the Tools group of the Design contextual tab on the ribbon. Access 2010 displays a key symbol to the left of the selected field(s) to acknowledge your definition of the primary key. When you've finished creating the Companies table for the Contact Tracking database, the primary key should be the CompanyID field.

Be sure to click the Save button on the Quick Access Toolbar to save this latest change to your table definition.

You can define the primary key for the Companies table easily by selecting the field in Design view and clicking the Primary Key button on the ribbon.

[Previous] [Contents] [Next]