16 min read
Primary Keys and Why They Matter
A primary key uniquely identifies every record in a table, with no two records ever allowed to share the same value — and relationships depend on it entirely.
You will learn: why names fail as keys. how to set a primary key on MemberID. You will do: click the key icon in Design View. save Members with AutoNumber as the key.
Two Sophie Walshes in London
Two people can share a name. Small example data for learning. A real library database may have thousands of records.
Both rows below are Sophie Walsh in London. They are different people. FullName alone cannot tell them apart.
Click the table name, a column heading, or any value. Each piece has a job.
Set the Primary Key
Goal
Set MemberID as the primary key.
Each member needs one unique ID. Access fills AutoNumber values for you.
Open Members in Design View
Where
Do this
Tables
- Members
Press F11 if this list disappears.
Verification
Check your work
You are correct if all of these are true:
- The key icon sits on MemberID only.
- FullName, City, and Phone have no key icon.
If something looks wrong
Fix
Field list
| Field Name | Data Type |
|---|---|
| MemberID | AutoNumber |
| FullName | Short Text |
| City | Short Text |
| Phone | Short Text |
Field Properties — MemberID
- Field Name
- MemberID
- Data Type
- AutoNumber
- Primary Key
- Yes
Click a row in the field list. In Access, the properties pane below updates for that field only.
Expected result in Datasheet View: leave MemberID blank on a new row. When you move off the row, Access fills the next number — 1, then 2, then 3. You do not type it.
Practice
Swipe or use the arrows to move between questions.
1 / 2
Field Notes: Why Not Just Use a Name?
Names feel like a natural identifier, but they fail quickly: two different people can easily share the exact same name, and one person's name might be spelled differently across different records. A dedicated ID number sidesteps the problem entirely — it never has to be unique in any real-world sense, because the computer decides it.
More lessons in Microsoft Access · Next: Entering and Editing Data in Datasheet View · Previous: Field Properties and Formatting
