View
232
Download
0
Category
Tags:
Preview:
Citation preview
Working with Multiple Tables in Microsoft Access
The Access Workbench: Section Two
DAVID M. KROENKE and DAVID J. AUER
DATABASE CONCEPTS, 3rd Edition
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-2
Section Objectives
Learn how to use Microsoft Access to: Illustrate modification problems Create relationships between tables Create multiple-table forms Create multiple-table reports
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-3
Illustrating Modification Problems
• When a table contains data from multiple themes, it is subject to modification problems
• This topic was discussed in detail in Chapter 1
• We will use an Access database to illustrate a modification problem
• The data is in a provided database named WMCRM-Combined-Data.mdb
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-4
CONTACT Data
CustomerID Date Type Remarks
1 7/7/2005 Phone General interest in a Gaea.
1 7/7/2005 Email Sent general information.
1 7/12/2005 Phone Set up an appointment.
1 7/14/2005 Meeting Bought a HiStandard.
3 7/19/2005 Phone Interested in a SUHi, set up an appointment.
1 7/21/2005 Email Sent a standard follow-up message.
4 7/27/2005 Phone Interested in a HiStandard, set up an appointment.
3 7/27/2005 Meeting Bought a SUHi.
4 8/2/2005 Meeting Talked up to a HiLuxury. Customer bought one.
3 8/3/2005 Email Sent a standard follow-up message.
4 8/10/2005 Email Sent a standard follow-up message.
5 8/15/2005 Phone General interest in a Gaea.
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-5
Security Warning
• Each time you open an existing database, the Security Warning dialog box will be displayed–as long as you are familiar with the database file, Click the Open button
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-6
Illustrating Modification Problems:
The CUSTOMER_CONTACT Table
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-7
Illustrating Modification Problems:The Customer-Contact Data Input Form
All fields from the CUSTOMER_CONTACT table appear on the form
Form browsing buttons
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-8
Illustrating Modification Problems:The Wallingford Motors Customer Contact Report
All contact data for each customer is grouped together and sorted by date
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-9
Illustrating Modification Problems:
Form with the Updated Email Address
The Email address has been updated
Next record button
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-10
Illustrating Modification Problems:Updated Wallingford Motors Customer Contact Report
A modification problem has occurred. Not all records were updated with the new email address, and the database records are now inconsistent.
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-11
Working with Multiple Tables:WMCRM Database Schema
CUSTOMER (CustomerID, LastName, FirstName, Address, City, State, ZIP,Phone, Fax, Email)
CONTACT (ContactID, CustomerID, Data, Type, Remarks)
CustomerID in CONTACT must exist in CustomerID in CUSTOMER
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-12
Working with Multiple Tables: CONTACT Table Column Characteristics
Column Name Type Key Required Remarks
ContactID AutoNumber Primary Key Yes Surrogate Key
CustomerID Number Foreign Key Yes Long Integer
Date Date/Time No Yes Short Date
Type Text (10) No Yes Allowed values are Phone, Fax, Email and Meeting
Remarks Memo No No
CONTACT
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-13
Working with Multiple Tables:Setting the Date Format
Select the Short Date date format from the drop-down list
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-14
Working with Multiple Tables:
Opening the Relationships Window
Click Tools, then click Relationships…
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-15
Working with Multiple Tables:Adding Tables to the Relationships Window
Select a table name, then click the Add button to add the table to the Relationships window
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-16
Working with Multiple Tables:Creating a Relationship
• To create a relationship between two tables:– In the Relationships window, drag a
primary key column and drop it on top of the corresponding foreign key column
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-17
Working with Multiple Tables:The Table Objects in the Relationships Window
The table objects have been enlarged and rearranged into the arrangement shown here
Click, drag and drop the CUSTOMER CustomerID field onto the CONTACT CustomerID field
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-18
Working with Multiple Tables:The Edit Relationships Dialog Box
Click the Enforce Referential Integrity check box, and then click the Create button to create the relationship
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-19
Working with Multiple Tables:The Completed Relationship
The new relationship now appears in the Relationships window diagram—note that the line connects the related fields
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-20
Working with Multiple Tables:Data in the CONTACT Table
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-21
Working with Multiple Tables:The Completed Form for CUSTOMER and CONTACT Data
Buttons for scrolling through the CONTACT records for this customer
Buttons for scrolling through the CUSTOMER records
KROENKE and AUER - DATABASE CONCEPTS (3rd Edition)© 2008 Pearson Prentice Hall AW-2-22
Working with Multiple Tables:The Wallingford Motors Customer Contacts Report
Data for each customer
List of contact data for each customer
Working with Multiple Tables in Microsoft Access
End of Presentation on The Access Workbench: Section Two
DAVID M. KROENKE and DAVID J. AUER
DATABASE CONCEPTS, 3rd Edition
Recommended