Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table...
-
Upload
loren-meggison -
Category
Documents
-
view
218 -
download
1
Transcript of Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table...
![Page 1: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/1.jpg)
Exploring MicrosoftAccess 2003
Chapter 5
One-to-Many Relationships: Subforms
and Multiple Table Queries
![Page 2: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/2.jpg)
Objectives (1 of 2)
• One-to-many relationship essential in database design
• Use the Relationship window
• Define referential integrity
• Distinguish between a main form and a subform
![Page 3: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/3.jpg)
Objectives (2 of 2)
• Create a query based on multiple tables
• Create a main form with two subforms
![Page 4: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/4.jpg)
Overview
• One-to-many relationships between tables is the real power of Access
• Primary key of one table is foreign key of the related table
• Referential integrity ensures consistency between tables
• Main forms and subforms created from related tables.• Reports based on a multiple-table query
![Page 5: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/5.jpg)
Case StudyConsumer Loans
• Understanding the need for a relational database• One-to-many relationship – use Relationships
window• Need a primary key, a unique identifier• Foreign key in the ‘many’ table is the primary key
in the ‘one’ table• Enforce referential integrity
![Page 6: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/6.jpg)
Relationships Window
ConsultantID is primarykey in Consultant table
Relationship line
ConsultantID is foreignkey in Clients table
![Page 7: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/7.jpg)
Referential Integrity
Delete Record button
Click + to displayrelated records
You cannot delete a Consultant without first deleting related Clients
![Page 8: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/8.jpg)
One-to-Many Relationships
Hands-On Exercise 1
• Open the National Bank Database• Create and Delete Relationships• Add a Customer Record• Add a Loan Record• Referential Integrity• Close the Database
![Page 9: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/9.jpg)
Subforms
• Subform is a form within a form• Main form would be based on primary table
while subform is based on related table• Use Subform Wizard• Can be created either on main form or dragged
from a separate form
![Page 10: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/10.jpg)
Subform
Consultant C01
Client related toConsultant C01
Status bar forClients form
Status bar forConsultants form
![Page 11: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/11.jpg)
Creating a Subform
Hands-On Exercise 2
• Create Customers Form using Form Wizard• Modify Customers Form• Create Loans Subform• View Customers Form• Add Payment Amount• Enter a New Loan• Print the Form
![Page 12: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/12.jpg)
Multiple Table Queries
• Query information from two tables
• Create a select query using both tables
• Query window displays selected fieldsof each table
![Page 13: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/13.jpg)
Multiple Table Queries
Run button
Column selector
Select table
Enter criteria
![Page 14: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/14.jpg)
Queries and Reports
Hands-On Exercise 3
• Create a Select Query
• Move and Size the Field Lists
• Create and Run the Query
• Create and Print a Report
![Page 15: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/15.jpg)
Expanding the Database
• Can expand a database without disturbing existing tables
• Use relationship window to establishhow fields from specific tables will be related
• Can use multiple subforms
![Page 16: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/16.jpg)
Linked Subforms
Hands-On Exercise 4• Add a relationship• Create the Payments Subform• Change the Default View• The Loans Subform in Form View• The Customers Form• The Finishing Touches• Make Your Payments
![Page 17: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/17.jpg)
![Page 18: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/18.jpg)
Chapter 5 Summary (1 of 2)
• Access database may contain multiple tables• Each table has a primary key which is the
foreign key of a related table• Relationships window to create one-to-many
relationships• Referential integrity ensures consistency
between related tables
![Page 19: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/19.jpg)
Chapter 5 Summary (2 of 2)
• Subform is a form within a form
• A main form can have multiple subforms
• Select query can include fields from several tables
• Tables can be added at any time withoutdisturbing existing data
![Page 20: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/20.jpg)
Practice with Access (1 of 2)
1. Adding Clip Art
2. The Report Wizard
3. Employees by Location
4. Employees by Title
![Page 21: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/21.jpg)
Practice with Access (2 of 2)
5. The Switchboard
6. The Table Analyzer Wizard
7. Synchronizing Reports
8. Data Access Pages
![Page 22: Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.](https://reader036.fdocuments.in/reader036/viewer/2022062417/5519b20355034660578b4625/html5/thumbnails/22.jpg)
Case Studies
• Recreational Sports League
• The Personnel Director
• The Franchise
• Widgets of America