Microsoft Office Tutorials and References
In Depth Information
Adding a primary key
Adding a primary key
It is recommended that every table has a primary key. This key
enables you to create relationships between tables of data. If
you can’t easily decide on a key, when you first save a new table
Access will warn you that there is no primary key and will then
add one if you agree to having an automatic number for the
primary key.
The primary key needs to be unique for every row in the table,
and it can consist of one or multiple fields. The primary key
must be given a value before the record can be saved, which
is another reason why AutoNumber data types (an automatic
sequence of numbers) are a popular choice for the primary key.
The primary key can be added or changed in both design and
layout views.
Define a primary key in design view
1 Right-click the table in the navigation pane.
2 Select Design View.
3 Select one or more fields. (Use the Ctrl key, and click the field
selector to pick multiple fields.)
4 Click Primary Key.
5 Click Save.
CAUTION To be part of a primary key, each field forming
part of the key must be given a value and must not contain
NULL (no values). The combination of these fields must also be unique.
TIP Web Apps support only numeric primary keys (normally
AutoNumber data types), so this is a good choice if you later
want to move your application to a Web App.
Search JabSto ::

Custom Search