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.
In this tutorial:
- Designing Client Tables
- Creating a New Database
- Creating a New Empty Database
- Creating Your First Simple Table by Entering Data
- Creating a Table Using Application Parts
- Creating a Table Using Data Type Parts
- Creating a Table in Design View
- Understanding Field Data Types
- Setting Field Properties
- Nulls and Zero-Length Strings
- Defining Simple Field Validation Rules
- Defining Input Masks
- Defining a Primary Key
- Defining a Table Validation Rule
- Understanding Other Table Properties
- Defining Relationships
- Defining Your First Relationship
- Creating a Relationship on Multiple Fields
- Adding Indexes
- Multiple-Field Indexes
- Setting Table Design Options
- Creating a Default Template for New Databases
- Printing a Table Definition
- Database Limitations