[ Team LiB ] Previous Section Next Section

The Benefits of Relationships

The primary benefit of relationships is the data integrity they provide. Without the establishment of relationships, users are free to add records to child tables without regard to entering required parent information. After you establish referential integrity, you can enable Cascade Update Related Fields or Cascade Delete Related Records, as appropriate, which saves you quite a bit of code in maintaining the integrity of the data in the system. Most relational database management systems require that you write the code to delete related records when the user deletes a parent record or to update the foreign key in related records when the user modifies the primary key of the parent. When you enable the Cascade Update Related Fields and Cascade Delete Related Fields check boxes, you are sheltered from having to write a single line of code to perform these tasks when they are appropriate.

Access automatically carries relationships into your queries. This means that each time you build a new query, Access automatically establishes the relationships between the tables within the query, based on the relationships that are set up in the Relationships window. Furthermore, each time you build a form or report, Access uses relationships between the tables included on the form or report to assist with the design process. Whether you delete or update data by using a datasheet or a form, all referential integrity rules automatically apply, even if you establish the relationship after you build the form.

    [ Team LiB ] Previous Section Next Section