When you create a relationship between two tables, it is usually a good idea to enforce referential integrity. Referential integrity keeps data accurate and ensures that you don’t accidentally change or delete related data in one table but not in the other.
Access is very picky about when you can set referential integrity. You can only use referential integrity when all the following conditions are met:
- One of the linked fields must be a primary key.
- The related fields must be the same data type and size.
- Both tables must be in the same Access database.
- You can't have a record in a related table unless a matching record already exists in the primary table.
Once you have established referential integrity, the following rules are set:
- You can’t add a record to a related table unless a matching record already exists in the primary table.
- You can’t change the value of a primary key in the primary table if matching records exist in the related table.
- You can’t delete a record from a primary table if matching records exist in a related table.
- Click the Database Tools tab.
- Click the Relationships button.