Creating a Relationship Between Tables

To create a relationship between tables, open the Relationships window and add relationships there. Follow these steps:

  1. In the database select Tools, Relationships.

  2. If you have not selected any tables yet, the Show Table dialog box (see Figure 25.1) appears automatically. If it doesn't, Open the Relationships menu and select Show Table or click the Show Table toolbar button.

    Figure 25.1. Add tables to your Relationships window using this dialog box.

  3. Click a table that you want to use for a relationship, then click the Add button.

  4. Repeat step 3 to select all the tables you want, then click Close. Each table appears in its own box on the Relationships window, as shown in Figure 25.2.

Make it Bigger

If you can't clearly see all the fields in a table's list, drag the border of its box to make it large enough to see everything. I've done that in Figure 25.2 to make the Dogs table completely visible.


Figure 25.2. I've added three tables to my Relationships window, for this example.


  1. Click a field in one table that you want to link to another table. For instance, I'm going to link the Coloring field in my Dogs table to the Color ID field in my Coloring table, so I'm going to click on the Coloring field in the Dogs table.

  2. Hold down the mouse button and drag away from the selected field. Your mouse pointer will turn into a little rectangle. Drop the little rectangle onto the destination field. For instance, I'm dragging to the Color ID field in the Coloring table. The Relationships dialog box appears (see Figure 25.3).

    Figure 25.3. The Relationships dialog box asks you to define the relationship you're creating.

  3. Choose any Referential Integrity options (see the following section), then click Create. A relationship will be created, and you'll see a line between the two fields in the Relationships window (see Figure 25.4).

    Figure 25.4. The line represents a relationship between the two fields.

Relationship Symbols

Notice in Figure 25.4 that next to the Dogs table there's an infinity sign (looks like a sideways 8), and next to the Coloring table there's a 1. These symbols appear in relationships where Enforce Referential Integrity is turned on. The infinity sign means "many"—that means many records in this table can match a single record (hence the 1 sign) in the related Coloring table.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.97.64