Database Reference
In-Depth Information
Field lists for the
tables to be related
134
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 (RepNum) of the Rep table to the foreign key (RepNum) of
the Customer table. After releasing the mouse button, you can request Access to enforce referential integrity
by selecting the Enforce Referential Integrity check box, as shown in Figure 4-18. You also can specify
whether update or delete operations will
Selecting the Cascade Delete Related Records check box
ensures that the deletion of a sales rep record also deletes all customer records related to that sales rep (also
known as cascade delete); selecting the Cascade Update Related Fields check box ensures that changes made
to the primary key of a sales rep record are also made in the related customer record (also known as cascade
update). In Figure 4-18, the cascade delete and cascade update options are not selected.
cascade.
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 cannot enter a customer record with a sales rep number that
does not match any sales rep number currently in the Rep table. An error message, such as the one shown in
Figure 4-19, appears when a user attempts to enter an invalid sales rep number.
Search WWH ::




Custom Search