Quick summary
Adding a foreign key in Microsoft Access links two tables through the Relationships tool, enforcing referential integrity so child records always match a valid parent entry. This step-by-step process uses the Database Tools ribbon to define and save table relationships without writing any SQL.
Steps
- Launch Microsoft Access and open the database where you want to add the foreign key, ensuring you have two tables ready.
- Go to the Database Tools tab in the ribbon.
- Click on Relationships to open the Relationships window.
- In the Relationships window, add both the parent and child tables by clicking Add Selected Tables.
- Drag the primary key field from the parent table and drop it onto the corresponding field in the child table.
- When the Edit Relationships dialog box appears, verify that the fields match correctly.
- Select Enforce Referential Integrity to prevent invalid entries in the child table that don't exist in the parent table.
- Click Create to establish the relationship.
- Click Save to save the relationships and finalize the foreign key configuration.
.gif)



