ACC: How to Group Row Headings in a Crosstab QueryID: Q143387
|
Moderate: Requires basic macro, coding, and interoperability skills.
This article describes how to group rows of data using a value range
rather than having a single row per value.
The following example uses a crosstab query (based on a select query) with
the Partition() function to indicate where a number occurs within a
calculated series of ranges.
Query: SalesInfo
------------------------------------------------------------
Type: Select Query
Join: Orders.[OrderID] <-> [Order Details Extended].[OrderID]
Field: EmployeeID
Table: Orders
Total: Group By
Field: Amount: ExtendedPrice
Table: Order Details Extended
Total: Sum
Field: Year: Year([OrderDate])
Total: Group By
Query: SalesRanges
----------------------------------------------------
Type: Crosstab Query
Field: SalesRange: Partition([Amount],0,100000,10000)
Total: Group By
Crosstab: Row Heading
Sort: Ascending
Field: Year
Total: Group By
Crosstab: Column Heading
Field: EmployeeID
Total: Count
Crosstab: Value
SalesRange 1994 1995 1996
-----------------------------------
0: 9999 2
10000: 19999 5
20000: 29999 1 1 2
40000: 49999 1 2 2
50000: 59999 2 1
60000: 69999 1
70000: 79999 2
80000: 89999 1 1
90000: 99999 1 1
100001: 1
For information about grouping column headings in a crosstab query, please
see the following article in the Microsoft Knowledge Base:
Q109949 ACC: How to Group Column Headings in a Crosstab Query
For more information about creating crosstab queries, search the Help
Index for "crosstab," or ask the Microsoft Access 97 Office Assistant.
For more information about the Partition() function, search the Help Index
for "Partition function."
Keywords : QryCross
Version : 2.0 7.0 97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 23, 1999