+ All Categories
Home > Documents > Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access...

Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access...

Date post: 20-Dec-2015
Category:
View: 223 times
Download: 1 times
Share this document with a friend
Popular Tags:
68
Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin
Transcript
Page 1: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Extended Learning Module J (Office 2007 Version)Implementing a Database with Microsoft Access

Copyright © 2010 by the McGraw-Hill Companies, Inc. All rights reserved.McGraw-Hill/Irwin

Page 2: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

STUDENT LEARNING OUTCOMES1. Identify the steps necessary to implement

the structure of a relational database using the data definition language provided by Microsoft Access.

2. Demonstrate how to use the data manipulation subsystem in Access to enter and change information in a database and how to query that information.

3. Explain the use of the application generation subsystem in Access to create reports and data entry screens.

Mod J-2

Page 3: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

MODULE ORGANIZATION

1. Solomon Enterprises Database Learning Outcome #1

2. Defining Relationships within the Solomon Enterprises Database

3. Entering Information into the Solomon Database Learning Outcome #2

4. Creating a Simple Query Using One Relation

Mod J-3

Page 4: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

MODULE ORGANIZATION

5. Creating an Advanced Query Using More than One Relation

6. Generating a Simple Report Learning Outcome #3

7. Generating a Report with Grouping, Sorting, and Totals

8. Creating a Data Input Form

Mod J-4

Page 5: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

SOLOMON DATABASE

The steps to creating a database are1. Define entity classes and primary keys

2. Define relationships among the entity classes

3. Define fields for each relation (file)

4. Use a data definition language to create the database, which is the focus of this Module

Mod J-5

Page 6: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

SOLOMON DATABASE

In Figure J.1 (p. 478) on the following 3 slides, we’ve recreated the correct database structure from Extended Learning Module C

Revisit Module C if you need a refresher

Mod J-6

Page 7: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

SOLOMON DATABASE

Mod J-7

Page 8: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

SOLOMON DATABASE

Mod J-8

Page 9: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

SOLOMON DATABASE

Mod J-9

Page 10: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating Solomon’s Database

Data dictionary - contains the logical structure for the information

To create the Solomon Enterprise database:1. Start Microsoft Access

2. Click on Blank Database in the upper left corner of the screen

3. Enter Solomon Enterprises.mdb as the database name

4. Click on Create

Mod J-10

Page 11: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating Solomon’s Database

Click on Click on Blank Blank DatabaseDatabase

Enter a Enter a database name database name

and click on and click on CreateCreate

Mod J-11

Page 12: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating Solomon’s Database

Our recommendation: Create a relation (table) in Design view: Must switch from Datasheet View to Design View Click on View in the upper left corner and then

Design View Enter a table name Use the Design View to enter the specifications for

the table

Mod J-12

Page 13: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating Solomon’s Database

To switch to To switch to Design View, click Design View, click on on ViewView and then and then

Design ViewDesign View

This is Design View – This is Design View – our recommendation our recommendation for creating the tables for creating the tables

in a databasein a database

Mod J-13

Page 14: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating the Raw Material Relation Enter the four fields of the Raw Material

relation Raw Material ID Raw Material Name QOH Supplier ID

Click on the Raw Material ID row and then the key button to designate Raw Material ID as the primary key

Mod J-14

Page 15: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating the Raw Material Relation

Primary key identifier and Primary key identifier and the the Primary key Primary key buttonbutton

Integrity constraints for Integrity constraints for Raw Material IDRaw Material ID

Mod J-15

Page 16: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating the Concrete Type Relation

Mod J-16

Page 17: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating the Bill of Material Relation We created (in Extended Learning Module C)

the Bill of Material relation to eliminate the many-to-many relationship between the Concrete Type and Raw Material relations

Mod J-17

Page 18: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating the Bill of Material Relation The Bill of Material relation has a primary key

composed of two fields (composite primary key): Concrete Type Raw Material ID

Composite primary key - consists of the primary key fields from the two intersecting relations

Mod J-18

Page 19: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating the Bill of Material Relation

Composite Composite primary keyprimary key

Mod J-19

Page 20: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

DEFINING RELATIONSHIPS WITHIN SOLOMON’S DATABASE The final structural task is to define how all

the relations relate to each other That is, link primary and foreign keys Foreign key - a primary key of one file

(relation) that appears in another file (relation)

Mod J-20

Page 21: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Primary and Foreign Key Logical Ties

Mod J-21

Page 22: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Defining Relationships between Relations To create relationships

Click on Database Tools in the menu area and then click on the Relationships button

Make each relation appear on the palette by highlighting each relation name and clicking on Add

Then click on the Close button

Mod J-22

Page 23: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Defining Relationships between Relations

Relationship Relationship palettepalette

Select tables Select tables and click on and click on

AddAdd

Mod J-23

Page 24: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Defining Relationships between Relations

Mod J-24

Page 25: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

ENTERING INFORMATION INTO SOLOMON’S DATABASE To enter information, you simply double-click

on the appropriate relation name

Supplier relation Supplier relation structurestructure

Mod J-25

Page 26: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Entering Information

Mod J-26

Page 27: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Referential Integrity

Referential integrity ensures consistency. For example, that you don’t put a non-existent Supplier ID into the Raw Material relation

The relationships we set up for referential integrity guard against bad information

Integrity constraints – rules that help ensure the quality of the information

Mod J-27

Page 28: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Enforcing Referential Integrity

Mod J-28

Page 29: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Change the Structure of a Relation

Mod J-29

Page 30: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

CREATING A SIMPLE QUERY USING ONE RELATION Query-by-example (QBE) tool - helps you

graphically design the answer to a question Suppose we wanted to see a list of raw

materials that shows Raw Material Name Supplier ID

Mod J-30

Page 31: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating a Simple Query Using the Raw Material Relation

First, click on First, click on CreateCreate and and then then Query DesignQuery Design

Second, select the table, Second, select the table, click on click on AddAdd, and then , and then

close the box.close the box.

Mod J-31

Page 32: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating a Simple Query Using the Raw Material Relation

The result of the The result of the queryquery

Drag and drop the appropriate Drag and drop the appropriate field names and then click on the field names and then click on the

exclamation point (exclamation point (RunRun).).

Mod J-32

Page 33: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Creating a Simple Query with a Condition

Set the condition Set the condition herehere

Mod J-33

Page 34: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

CREATING AN ADVANCED QUERY USING MORE THAN ONE RELATION Suppose we want a query that shows

All order numbers Date of orders Where the goods were delivered The contact person The truck involved in each delivery The truck driver in each delivery

Mod J-34

Page 35: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Steps to Create an Advanced Query1. Click on Create in the menu area and then

Query Design

2. In the Show Table dialog box Select and Add the relation names Close the Show Table dialog box Tables linked appear are joined by lines with

1 beside the table with the primary key The infinity sign by the table with the foreign key

Mod J-35

Page 36: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Steps to Create an Advanced Query3. Drag and drop the fields that you want from

the appropriate relation into the QBE grid in the order that you want

4. Click on the exclamation point (Run) in the button bar to see the results of the query

Mod J-36

Page 37: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Steps to Create an Advanced Query

Mod J-37

Page 38: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Steps to Create an Advanced Query

Mod J-38

Page 39: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Steps to Create an Advanced Query

Mod J-39

Page 40: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

GENERATING A SIMPLE REPORT1. Click on Create in the menu area and then

the Report Wizard button

2. Choose tables and/or queries: Lets you choose which table/query you want

3. Choose fields: Lets you choose the fields you want

Mod J-40

Page 41: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Grouping, Sorting, Layout of Report4. Grouping: Lets you specify grouping of

information (we chose the default)

5. Sorting: Allows you to specify sorting (we chose the default)

6. Layout and orientation: Allows you to select layout and page orientation (we chose the default)

Mod J-41

Page 42: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Style and Header of Report

7. Style: Allows you to choose from among predefined report styles (we chose the default)

8. Report header: Allows us to enter a title for the report.

9. The Report: Shows all customers and phone numbers.

Mod J-42

Page 43: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Choose Table/Query and Fields

1. Start to create a report1. Start to create a report

2. Choose tables and/or queries2. Choose tables and/or queries

Mod J-43

Page 44: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Choose Table/Query and Fields

3. Choose fields3. Choose fields

4. Grouping4. Grouping

Mod J-44

Page 45: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Grouping, Sorting, Layout, Style, and Title

5. Sorting5. Sorting

6. Layout and orientation6. Layout and orientation

Mod J-45

Page 46: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Grouping, Sorting, Layout, Style, and Title

7. Style7. Style

8. Report Header8. Report Header

Mod J-46

Page 47: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Grouping, Sorting, Layout, Style, and Title

Mod J-47

Page 48: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

REPORT WITH GROUPING, SORTING, AND TOTALS Say we want to create the Supply Chain

Management report from Extended Learning Module C

First, create a query Then, put the query into the report generator

Mod J-48

Page 49: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Steps for Creating a Report with Grouping, Sorting, and Totals1. Click on Create in the menu area and click

on the Report Wizard button

2. Choose tables/queries: Query: Supply Chain Query

3. Choose fields: Select all fields by clicking on the double greater-than sign (>>)

Mod J-49

Page 50: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Specify Table/Query Fields

Mod J-50

Page 51: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Grouping and Sorting Information

4. Top-level grouping: Allows you to choose ordering. Since we created a query, Access has defaulted to the first field

5. Further grouping: Lets you specify groups within the top grouping of Concrete Type, but we don’t want any further grouping

6. Sorting: Next we have a chance to sort our information

Mod J-51

Page 52: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Steps for Grouping Information

Mod J-52

Page 53: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Steps for Sorting Information

Mod J-53

Page 54: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Totaling Information in a Report

7. Totaling: The sorting screen also has a Summary Options button

Within Summary Options you can choose what type of summary you want

Mod J-54

Page 55: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Totaling Information in a Report

Mod J-55

Page 56: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Formatting the Report

8. Overall structure of report: Allows you to choose the layout and orientation

9. Style of report: Allows you to choose a style

10. Report heading: Allows you to enter the title that will appear on the report, then click on Finish

Mod J-56

Page 57: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Formatting the Report

Mod J-57

Page 58: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

The Report

11. The Report: Shows the information from the wizard steps

Mod J-58

Page 59: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Refining the Report

Steps to adjust the report to make it aesthetically pleasing Open the report in Design View with the triangle

button Adjust the boxes to the desired size Delete unwanted entries

Mod J-59

Page 60: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Refining the Report

Click on Click on Design Design ViewView to see the to see the report in design report in design

formatformat

Mod J-60

Page 61: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Adjusting the Page Header

Mod J-61

Page 62: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Adjusting the Concrete Type Header

Mod J-62

Page 63: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Adjusting the Detail Section

Mod J-63

Page 64: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Adjusting the Concrete Type Footer

Mod J-64

Page 65: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

The Completed Report

Mod J-65

Page 66: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

CREATING A DATA INPUT FORM1. Select the Order table

2. Click on Create and then Form

Mod J-66

Page 67: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Choose Table/Query

Mod J-67

Page 68: Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access Copyright © 2010 by the McGraw-Hill Companies, Inc. All.

Final Input Form

Mod J-68


Recommended