Datasheet
19. In the Show Table dialog box, select all three tables and click the Add button. Then click the
Close button to close the Show Table dialog box.
20. The Relationships designer now shows all three tables. Click the GroupID column in the
GroupProjects table and drag it over to the Groups table and drop it on the GroupID column.
This causes the Edit Relationships dialog box to be displayed, as shown in Figure 1-7.
Figure 1-7
21. Click the Enforce Referential Integrity check box and click Create to create the relationship.
22. Click the ProjectID column in the GroupProjects table and drag it over to the Projects table and
drop it on the ProjectID column. When the Edit Relationships dialog box is displayed, check the
Enforce Referential Integrity check box and click Create to create the relationship.
23. Click the File menu and choose Save or click the Save icon to save your relationships.
24. Close the Relationships designer by clicking the X in the upper-right corner of the designer.
25. Close Access by clicking the File menu and choosing Exit or by clicking the X in the upper-right
corner of the window.
How It Works
You start by creating your tables. As part of this process, you designate the first field name in each table
as the primary key. This tells Access that this column is the primary key of the table and Access imple-
ments the rules to enforce this column as a primary key, including not allowing
NULL values in this field
and preventing you from entering duplicate values in this field. Access also creates an index on this
column, providing efficient access to the data in these tables when accessed using the primary key.
After your tables are created, you define the relationships between your tables using the Relationships
designer. By dragging the foreign key from the GroupProjects table to the primary key of the Groups
table, you create a one-to-many relationship between the Groups and GroupProjects tables. This means
that one row of data in the Groups table corresponds to many rows in the GroupProjects table. You do
the same thing for the Projects table, creating a one-to-many relationship between the Projects and
GroupProjects tables.
19
Databases
04_58894x ch01.qxd 10/13/05 5:54 PM Page 19