Step by step exercise: Creating relationships



To practice the procedures of creating relationships between tables with Access2003.


1 Open the Classes database, from My Documents folder.

We are going to relate the Students and Courses tables. The existing relationship between the Courses and Students is One to Many as a course has various records related in the Students table, but a student can only have one course, and so the primary table will be Courses and the related table will be Students.

As we have still not defined any relationship, the Relationship window is still empty. In order to create a relationship we first need to have the tables in the Relationship window.

2 Situate yourself in the Database window.

3 Open the Tools menu.

4 Select the Relationships... option.

Or, click on the button on the toolbar.

The Show tables dialogue box will appear.

5 Select the Courses table.

6 Click on the Add button.

7 Select the Students table.

8 Click on the Add button.

7- 8 Or double-click on Students name

9 Click on the Close button.


Now we will define the relationship, the two tables will be related by the Course code field:

10 Locate the relationship field in the principal table, Course code in Courses table and the relationship field in the related table (Course field in Students table) .

11 Click on Course code in Courses table and drag it over Course field in Students table.

The Edit relationships dialogue box will appear.

Above should be the names of the related tables, and below these the relationship fields Course code and Course.

12 Check the Enforce Referential Integrity box by clicking on it.

13 Click on Create button.

The relationship is created and will appear in the Relationship window. If you have some problems make sure you have done correctly the step by step exercise in Unit 5.

14 Close the Relationships window by clicking on the button.


Legal warning: Authorised on-line use only. It is not allowed the use of these courses in companies or private teaching centres.
© aulaClic. All rights reserved. Reproduction in any form whatsoever is prohibited. April-2006.