Database Reference
In-Depth Information
Let's add the Employees table to the Relationships page so that we can create a
relationship that links that table to the Orders table.
10
On the Design tool tab, in the Relationships group, click the Show Table button.
Then in the Show Table dialog box, double-click the Employees table, and click
Close .
TIP You can also add tables by dragging them from the Tables group of the Naviga-
tion pane to the Relationships page.
11 If necessary, drag the title bars of the three field lists to arrange them so that they are
side by side and equidistant.
12
In the Employees field list, click the EmployeeID field, and drag it down and over the
EmployeeID field in the Orders field list. Then in the Edit Relationships dialog box,
select the Enforce Referential Integrity check box, and click Create .
13
After Access draws the relationship line between the primary key and the foreign key,
close the Relationships page, clicking Yes to save its layout.
Now let's test the relationships.
14
Open the Orders table. Then in the CustomerID field of the first record, change the 0
value to 11 , and click below the record to complete it. Access displays a message box
telling you that you cannot add the new record to the table.
The value in the CustomerID field in the Orders table must match a value in the primary key
CustomerID field in the Customer table.
15
Click OK . Then change the value to 1 .
16
In the EmployeeID field, change the 0 value to 1 , and then click below the record to
complete it. Access accepts the record because there is a record with the value 1 in
the primary key CustomerID field of the Customers table and a record with the value
1 in the primary key EmployeeID field of the Employees table.
CLEAN UP Close the Orders table, and then close the My Tables database.
Search WWH ::




Custom Search