Define relationships between tables
Close any tables you have open. You can't create or modify relationships between open tables.
If you haven't already done so, switch to the Database window. You can press F11 to switch to the Database window from any other window.
Click Relationships on the toolbar.
If your database doesn't have any relationships defined, the Show Table dialog box will automatically be displayed. If you need to add the tables you want to relate and the Show Table dialog box isn't displayed, click Show Table on the toolbar. If the tables you want to relate are already displayed, skip to step 6.
Double-click the names of the tables you want to relate, and then close the Show Table dialog box.
Drag the field that you want to relate from one table to the related field in the other table.
To drag multiple fields, press the CTRL key and click each field before dragging them.
In most cases, you drag the primary key field (which is displayed in bold text) from one table to a similar field (often with the same name) called the foreign key in the other table. The related fields don't have to have the same names, but they must have the same data type (with two exceptions) and contain the same kind of information. In addition, when the matching fields are Number fields, they must have the same FieldSize property setting. The two exceptions to matching data types are that you can match an AutoNumber field with a Number field whose FieldSize property is set to Long Integer; and you can match an AutoNumber field with a Number field if both fields have their FieldSize property set to Replication ID.
The Edit Relationships dialog box is displayed. Check the field names displayed in the two columns to ensure they are correct. You can change them if necessary.
Set the relationship options if necessary. For information about a specific item in the Relationships dialog box, click the question mark button , and then click the item.
Click the Create button to create the relationship.
Repeat steps 5 through 8 for each pair of tables you want to relate.
When you close the Relationships window, Microsoft Access asks if you want to save the layout. Whether you save the layout or not, the relationships you create are saved in the database.
If you need to view all the relationships defined in the database, click Show All Relationships on the toolbar. To view only the relationships defined for a particular table, click the table, and then click Show Direct Relationships on the toolbar.
If you need to make a change to the design of a table, you can right-click the table you want to change, and then click Table Design.
You can create relationships using queries as well as tables. However, referential integrity isn't enforced with queries.
To create a relationship between a table and itself, add that table twice. This is useful in situations where you need to perform a lookup within the same table. For example, in the Employees table in the Northwind sample database, a relationship has been defined between the EmployeeID and ReportsTo fields, so that the ReportsTo field can display employee data from a matching EmployeeID.