How to Add Foreign Key in MS Access
In Microsoft Access, you can add a foreign key to enforce relationships between tables and maintain data integrity. Here's a step-by-step guide:
- Launch Microsoft Access and open the database where you want to add the foreign key. Ensure you have two tables.
- Go to the 'Database Tools' tab in the ribbon.
- Click on 'Relationships'.
- In the 'Relationships' window, add both the parent and child tables to the window 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.
- The Edit Relationships dialog box will appear. Verify that the fields match correctly.
- Select 'Enforce Referential Integrity' to ensure that you cannot enter a value in the child table that doesn't exist in the parent table.
- Click 'Create' to establish the relationship.
- Save the relationships by clicking 'Save'.
This website uses cookies to ensure you get the best experience on our website. Learn More
Got it