Access - Pearson Higher Education

Access CH03 More Skills11.qxd
CHAPTER 3
5/22/08
10:42 AM
Page 1
Access
More Skills 11 Create a Crosstab Query
䉴
A crosstab query is a type of select query that calculates a sum, average, or similar statistic, and
then groups the results by two sets of values.
䉴
A crosstab query displays one group of results down the side of the datasheet and the other
group of results across the top of the datasheet—for example, you could display golfer’s
names on the left, golf rounds across the top.
To complete this database, you will need the following file:
䊏 a03_Cypress_Scores
You will save your files as:
䊏 a03_Cypress_Scores_Your_Name
1.
Start
Access, and then open a03_Cypress_Scores. Save the database in your Access
Chapter 3 folder as a03_Cypress_Scores_Your_Name If the security message displays,
enable the content.
2.
In the Navigation Pane, right-click Dorian 2009 Scores, and then click Design View. In the
Criteria row for the Tournament column, type Dorian Invitational 2009
3.
Run the query. Be sure that 39 records display, and then Save
4.
In the first displayed record of the query datasheet, change Your and Name to your own first
and last names, and then Close
the query.
5.
Display the Create tab, and then in the Other group, click the Query Wizard button.
Microsoft Access | Chapter 3 - Creating Queries and Reports
From Skills for Success with Microsoft® Office 2007 by Kris Townsend
the query.
More Skills: SKILL 11 | Page 1 of 5
Copyright © 2009 by Pearson Education, Inc. All rights reserved.
Access CH03 More Skills11.qxd
6.
5/22/08
10:42 AM
Page 2
In the displayed New Query dialog box, select Crosstab Query Wizard as shown in Figure 1,
and then click OK.
Crosstab Query Wizard selected
Figure 1
7.
In the displayed Crosstab Query Wizard, under View, select the Queries option button as
shown in Figure 2.
A query can be built from another query. In this case, the crosstab query will use the
data from the Dorian 2009 Scores query.
Queries option selected
Figure 2
Microsoft Access | Chapter 3 - Creating Queries and Reports
From Skills for Success with Microsoft® Office 2007 by Kris Townsend
More Skills: SKILL 11 | Page 2 of 5
Copyright © 2009 by Pearson Education, Inc. All rights reserved.
Access CH03 More Skills11.qxd
8.
5/22/08
10:42 AM
Click Next, and then Move
Page 3
First Name and Last Name into the Selected Fields list.
In the crosstab query datasheet, each player will be listed in the first two columns.
9.
Click Next, and then in the list of column headings, click Round as shown in Figure 3.
The scores for each round will display to the right of each player’s name.
Scores for rounds
display in columns
Players display in rows
Figure 3
Microsoft Access | Chapter 3 - Creating Queries and Reports
From Skills for Success with Microsoft® Office 2007 by Kris Townsend
More Skills: SKILL 11 | Page 3 of 5
Copyright © 2009 by Pearson Education, Inc. All rights reserved.
Access CH03 More Skills11.qxd
10.
5/22/08
10:42 AM
Page 4
Click Next, and then under Fields, click Score. Under Functions, click Sum, and then compare your screen with Figure 4.
With the Yes, include row sums check box selected, the total score for all three rounds
will also be calculated.
Score field selected
Sum function selected
Yes, include row
sums selected
Figure 4
11.
Click Next, and then click Finish. Compare your screen with Figure 5.
Figure 5
12.
Close
the query. In the Navigation Pane, select Dorian 2009 Scores_Crosstab. From
the Create tab, in the Reports group, click the Report button.
13.
Click Save
, and then in the displayed Save As dialog box, click OK.
Microsoft Access | Chapter 3 - Creating Queries and Reports
From Skills for Success with Microsoft® Office 2007 by Kris Townsend
More Skills: SKILL 11 | Page 4 of 5
Copyright © 2009 by Pearson Education, Inc. All rights reserved.
Access CH03 More Skills11.qxd
14.
5/22/08
10:42 AM
Page 5
Close
the Navigation Pane, and then decrease the width of the First Name and Last
Name columns as shown in Figure 6.
Column widths decreased
Figure 6
15.
Apply the Apex AutoFormat—the third choice in the AutoFormat gallery.
16.
Double-click the report title, and then change the title to Dorian Invitational 2009 Scores
17.
Double-click the Total Of Score label, and then change the label’s text to Total Score
18.
With the label still selected, display the Home tab, and then in the Sort & Filter group, click
the Ascending button .
19.
If your instructor asks you to print your work, print the report.
20.
Save , and then Close
Access.
䊏
the report. Open
the Navigation Pane, and then Exit
You have completed More Skills 11
Microsoft Access | Chapter 3 - Creating Queries and Reports
From Skills for Success with Microsoft® Office 2007 by Kris Townsend
More Skills: SKILL 11 | Page 5 of 5
Copyright © 2009 by Pearson Education, Inc. All rights reserved.