Setting the Primary Key
An important aspect of table structure design is that each table must have a field that is used to uniquely identify the records in the table. This field is called the primary key. Setting an appropriate key is trickier than it appears because no two records can have the same key value. In a table of customers, for example, you might think the Last Name field would be a good key, but this theory falls flat as soon as you find that you have more than one customer with the same last name . A more appropriate primary key for your customers is a Social Security number (although people don't like to give these out) because it uniquely identifies each customer.
A good general rule is to create an identification field, such as a customer number, that allows you to assign a sequential number to each customer as you add them to your database table. Access can even help you out with the assigning of numbers to the customers because you can make the field type for the Customer Number field AutoNumber. An AutoNumber field type assigns a number to each record starting with the number 1.
Creating the Primary Key Typically, the first field in the table serves as the primary key.
To set a primary key, follow these steps:
No Primary Key! If you attempt to close your new table in the Design view without specifying a primary key (even if you have saved the table), a message appears, letting you know that no primary key has been assigned. Click Yes on the message box to have Access assign a primary key to the table. If you have set up your table to contain an AutoNumber field, Access will make this field the primary key. Otherwise, Access creates a new AutoNumber field in the table and specifies it as the primary key. You can change the name of this new field as needed.