Microsoft Office Tutorials and References
In Depth Information
Creating Relationships and Protecting Your Data with Referential Integrity
✦ Cascade Update Related Fields: This option ensures that if the value of
the primary key field changes in the master table, the same change
cascades to all records in the detail table. (This option doesn’t apply if the
primary key is an AutoNumber field.)
After an AutoNumber field receives a value, that value never changes.
✦ Cascade Deleting Related Records: This option ensures that if a record
in the master table is deleted, all corresponding records in the detail
table are also deleted.
We describe both options in “Setting referential integrity between two
tables,” later in this chapter.
You can choose to enable referential integrity as soon as you join two tables
in the Relationships window, which we discuss later in this chapter. You
can change or disable referential integrity options at any time, so you’re not
making a lifelong commitment or anything.
Opening the Relationships window
The place where you actually join tables and enforce referential integrity
between them is called the Relationships window — the same window we
show in Figure 6-3, earlier in this chapter. Clearly, if you want to be able to
set up referential integrity between two tables, you’re going to need some
hints on how to open the Relationships window. How about some explicit
instructions, such as the following?
1. If any tables are open, close them.
Access can’t create a relationship if one of the tables involved is open.
2. Click the Relationships button in the Relationships group on the
Database Tools tab of the Ribbon.
Access opens the Relationships window.
The Relationships window may be empty when you first open it, but if we
know you, it won’t be that way for long; you can (and probably will) add
tables to the window at any time, as the next section makes clear. It’s also
possible that some relationships may have already been created, even if you
don’t remember creating them. There are ways to define relationships that
don’t use the Relationships window, such as using the Lookup Wizard.
Book II, Chapter 5 describes relationships created with the Lookup Wizard.
Adding tables to the Relationships window
When the Relationships window is open, you can add tables to it by
following these steps: