Download presentation
Presentation is loading. Please wait.
Published byNeil Rich Modified over 8 years ago
1
Exploring Microsoft Access Chapter 6 Many-to-Many Relationships: A More Complex System
2
Objectives (1 of 2) Define and explain a many-to-many relationship Use Cascade Update and Cascade Delete Explain how the AutoNumber field simplifies entering new records
3
Objectives (2 of 2) Create a main farm and subform based on a query Create a parameter query Use aggregate functions Use Get External Data command
4
Overview (1 of 2) More database design practice Extends relational database concepts including one-to-many and many-to-many relationships Use AutoNumber to simplify record creation
5
Overview (2 of 2) Extends subform and query information from related tables Create forms based on multiple-table queries Create a parameter query Create queries with built-in aggregate functions
6
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 The primary key of the additional table is the combination of the primary keys of the related tables
7
Implementing Many-To-Many Relationships Many-to-many relationship is implemented by a pair of one-to-many relationships Enforce Referential Integrity is selected Cascade Delete Related Records is selected
8
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 Prevents deleting a record in the primary table when there are corresponding records in the related table
9
Cascaded Deletion When a record in the primary table is deleted, Access simultaneously deletes the corresponding records in the related table
10
Cascaded Updating When the primary key in the primary table is updated, Access automatically updates the value in the corresponding records in the related table
11
Subforms, Queries, and AutoLookup Main and subforms based on queries: - display of information from multiple tables - display records other than by primary key AutoLookup will find corresponding data after unique ID is entered
12
Main Form and Subform Main form has fields from Orders and Customers tables Subform has fields from Order Details and Products tables
13
Designing a main and subform Main form Detail Subform Detail
14
Parameter Queries Prompts the user for criteria when executed The prompt is enclosed in square brackets in the query design grid A parameter query may prompt for any number of variables
15
Parameter Query Enter the prompt in square brackets in the Criteria field Users are prompted with a dialog box when the query is executed
16
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 that field for each group of records
17
Adding Tables Existing tables and relationships are unaffected by addition of new table
18
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 Base forms and subforms on queries
19
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 without affecting data in the existing tables
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.