tags:

views:

131

answers:

2

I've got a query that returns Headcount and Newcomers values for months like this:

Month      Headcount   Newcomers
January    12          2
February   14          1
...

and so on.

I would like to display them in a report this way:

            January     February   ...
Headcount   12          14
Newcomers   2           1

Is it possible in MS Access? To create a query that would return such data using my query or to create a report that could display data returned by my query in this way? I've read about pivot tables and crosstab queries but this is not what I am looking for, as they do not simply rotate the matrix.

A: 

You'll have to write a new query to sum by Month and Group By on the field that determines Headcount and Newcomers

HardCode
more details would be nice
agnieszka
Knowing your exact table structure to write a query for you would also be nice.
HardCode
+1  A: 

I wasn't able to pull into a single query.

Call one query: Table1_Crosstab_HeadCount with this sql

TRANSFORM Max(Table1.HeadCount) AS MaxOfHeadCount
SELECT "HeadCount" AS Value_Type
FROM Table1
GROUP BY "HeadCount"
PIVOT Table1.Month;

Call second query: Table1_Crosstab_Newcomers with this sql

TRANSFORM Max(Table1.NewComers) AS MaxOfNewComers
SELECT "Newcomers" AS Value_Type
FROM Table1
GROUP BY "Newcomers"
PIVOT Table1.Month;

Create a 3rd union query (pardon my Select *)

select * from Table1_Crosstab_HeadCount
UNION ALL
Select * from Table1_Crosstab_Newcomers;

Use the third query for your report. Note: if you don't have a record for a particular month, it won't be available as a field in the report designer.

Jeff O
If you right click on the column that holds the column headings and enter values in for the column headings (separated by semi colons) you can define colums that don't exist in your dataset yet).
Praesagus