1 PROJECT 12 REPORTS BASED ON QUERIES Management Information Systems, 9 th edition, By Raymond...

Preview:

Citation preview

1

PROJECT 12REPORTS BASED ON

QUERIES

Management Information Systems, 9th edition,By Raymond McLeod, Jr. and George P. Schell

© 2004, Prentice Hall, Inc.

2

Learning Objectives:• Learn to create a report based on query

results.

• Learn to pass query parameters to reports.

• Understand how built-in Access functions can change report content.

• Understand how to generate field values based upon query values.

• Learn to make calculations within reports.

3

Introduction

• Project 12 contains some advanced database concepts for queries and reports

• If you have completed Project 9 and either Project 10 or 11 then you should be prepared for this project

4

EXAMPLE• This example will generate queries and reports

from data in the Textbook database• Managers typically use queries to look for specific

records and so the query is constrained to records that have certain values for fields

• Reports based on query results must usually be modified from the default report settings in order to create visually appealing reports

• Creating reports based upon query results is valuable so that the decision maker can produce documents for his or her subordinates

5

Textbook Database• The Textbook database consists of four tables that

relate to each other by common values• The tables and their data fields are shown in

Figure P12.1• From Figure P12.2 you can see Amy Abner and

Brian Janski both have book number 409 to sell• In Figure P12.3, Book number 409 has a title of

“Management Information Systems” and was authored by McLeod and Schell

• Notice from Figure P12.4 that the “Queries” tab is chosen

6

7

8

9

10

CREATING A QUERY AND REPORT TO SHOW BOOKS REQUIRED FOR

CLASSES• A decision maker may need to see books required

for each class• A standard report will generate this information as

long as each class requires a book. But classes that do not require a book would not be shown on a standard report

• A query must be made that will include all classes whether or not they require a book

• As an additional piece of information, the course level for a class (i.e., “Freshman,” “Sophomore,” “Junior,” and “Senior”) should be shown. Figure P12.5 displays the final report

11

12

13

14

15

16

17

18

19

20

21

22

CREATING A REPORT FROM A PARAMETER QUERY

1. Create a report using Access’ “report wizard” and choose the “Books for Classes” query as the source for the report.

2. When asked, choose the ClassNumb, Title, and Level fields for the report.

3. You do not have to do any grouping other than what is default but when you advance to the screen shown in Figure P12.11, choose to sort the results based on the values in the Title field.

4. The report layout and style can be your choice but “Stepped” and “Corporate” are frequently used.

5. Make the title of the report “Books Required for Classes” before clicking the “Finish” button and viewing the results.

23

24

25

26

27

28

29

ASSIGNMENT1. Create a report of classes using each book. Use Figure

P12.22 to guide your report creation. Note that the book title “Counting Pennies” is not used in any class.

2. Create a report similar to Figure P12.23. That report is based upon a parameter query that asks the user to supply the class number for the report. One note of caution: Some courses will not have any students who sell books for that course. In those cases, there will be no records in the report.

3. Create a report similar to Figure P12.24. That report is based upon a parameter query that asks the user to provide a minimum enrollment size. The parameter value (55 for this example) should be displayed in the report title.

30

31

32

33

END OF PROJECT 12

Recommended