Databases Reference
In-Depth Information
Field lists for
the tables to be
related
132
Primary key
Foreign key
FIGURE 4-17
Using the Relationships window to relate tables in Access
You use the pointer to drag the primary key of the Rep table (RepNum) to the foreign key of the Customer table
(RepNum). After releasing the mouse button, you can request Access to enforce referential integrity, as shown in
Figure 4-18. You also can specify whether update or delete operations will “cascade.” Selecting the cascade delete
option ensures that the deletion of a sales rep record also deletes all customer records related to that sales rep;
selecting the cascade update option ensures that changes made to the primary key of a sales rep record are also
made in the related customer record. In Figure 4-18, the cascade delete and cascade update options are not selected.
Primary key
(Rep table)
Foreign key
(Customer table)
Enforce Referential Integrity
check box is selected
FIGURE 4-18
Specifying referential integrity in Access
With referential integrity enforced, users are not allowed to enter a customer record whose sales rep num-
ber does not match any sales rep currently in the Rep table. An error message, such as the one shown in
Figure 4-19, appears when an attempt is made to enter an invalid sales rep number.
 
 
Search WWH ::




Custom Search