Exploring Microsoft Access
Chapter 6
Objectives
(1 of 2)• Define and explain a many-to-many relationship
• Use Cascade Update and Cascade Delete
Objectives
(2 of 2)• Create a main farm and subform based on a query
• Create a parameter query • Use aggregate functions
Overview
(1 of 2)• More database design practice
• Extends relational database concepts
including one-to-many and many-to-many relationships
Overview
(2 of 2)• Extends subform and query information from related tables
• Create forms based on multiple-table queries
• Create a parameter query
Many-to-Many Relationships
• A many-to-many relationship requires an additional table that has a one-to-many relationship to each of the related tables
Implementing Many-To-Many
Relationships
Many-to-many relationship is implemented by a pair of one-to-many
relationships
Enforce Referential Integrity is selected
Referential Integrity
• Ensures records in related tables are consistent with one another
• Prevents adding a record to a related table with an invalid foreign key
Cascaded Deletion
• When a record in the primary table is
Cascaded Updating
Subforms, Queries, and
AutoLookup
• Main and subforms based on queries: - display of information from multiple tables
- display records other than by primary key
Main Form and Subform
Main form has fields
from Orders and Customers
tables
Designing a main and subform
Main form Detail
Parameter Queries
• Prompts the user for criteria when executed
• The prompt is enclosed in square brackets in the query design grid
Parameter Query
Enter the prompt in square brackets in the Criteria field
Users are prompted
Total Queries
• Total Queries perform calculations on a group of records
• Total row – Contains either Group by or aggregate
entry
• Group By – Records in the dynaset are to be
grouped according to the like values
• Sum Function – Specifies math to be performed on
Adding Tables
Existing tables and
Chapter 6 Summary
(1 of 2)• A many-to-many relationship requires an additional table
• Many-to-many is implemented with a pair of one-to-many relationships
• Enforce referential integrity to prevent errors
Chapter 6 Summary
(2 of 2)• Parameter query uses prompts
• Aggregate functions perform calculations on groups of records
• New tables may be added at any time