Microsoft Office Tutorials and References
In Depth Information
Referential Integrity
Customer as the primary table and Contract as the related table, and with CustomerID
as the common fi eld (the primary key in the Customer table and a foreign key in the
Contract table). You’ll also defi ne a one-to-many relationship between the Contract and
Invoice tables, with Contract as the primary table and Invoice as the related table, and
with ContractNum as the common fi eld (the primary key in the Contract table and a
foreign key in the Invoice table).
To define the one-to-many relationship between the Customer and
Contract tables:
1. Click the Database Tools tab on the Ribbon.
2. In the Relationships group on the Database Tools tab, click the Relationships
button. The Show Table dialog box opens. See Figure 2-39.
Figure 2-39
Show Table dialog box
add these two tables
to the Relationships
window
You must add each table participating in a relationship to the Relationships
window. Because the Customer table is the primary table in the relationship, you’ll
add it first.
3. Click Customer , and then click the Add button. The Customer table’s field list is
added to the Relationships window.
You can also double-click
a table in the Show Table
dialog box to add it to the
Relationships window.
4. Click Contract , and then click the Add button. The Contract table’s field list is
added to the Relationships window.
5. Click the Close button in the Show Table dialog box to close it.
So that you can view all the fields and complete field names, you’ll resize the
Customer table field list.
6. Use the pointer to drag the bottom of the Customer table field list to lengthen it
until the vertical scroll bar disappears and all the fields are visible.
To form the relationship between the two tables, you drag the common field of
CustomerID from the primary table to the related table. Then Access opens the
Edit Relationships dialog box, in which you select the relationship options for the
two tables.
7. Click CustomerID in the Customer field list, and then drag it to CustomerID in
the Contract field list. When you release the mouse button, the Edit Relationships
dialog box opens. See Figure 2-40.
Search JabSto ::




Custom Search