crosstab product/report

cpberg1

It's always rainy here
Local time
Today, 12:47
Joined
Jan 21, 2012
Messages
79
Access 2003
Win XP, 7

hey all,

I'm having some issues with the dispay of some data created in multiple crosstab queries.

I can easily get the data that I want to display, but I'm having a hard time to format the results in something that looks close to what I want. My ideal display preference is in the excel sheet attached. Two options on different sheets, either one would be great.

The closest I've gotten is with a crosstab query but I'm having challenges putting together both values.

Esentially I want to group by Students and Lessons and then show two values pulled from queries. Max flight# per lesson and total hours per lesson. The lesson numbers go quite high (about 100) so the wrap or continuation to next page can hopefully be clean. I've tried crosstabs and creating two crosstab queries to get the appropriate data, but can't then figure out how to get both queries to mesh up on one report.

Some guidance towards the next step is appreciated!

Best, Chris
 

Attachments

If I go by how your sample file looks, is the first row from one crosstab and the second row from the other crosstab? If so, you could consider to union the two crosstab queries, then the data should flow fine on the report with only the union query as its record source. You can add col headings in the properties window of each crosstab to ensure that the number of cols are the same for both crosstabs.
 
Thanks I'll give a go with a union query when I get home from work. :)
 

Attachments

  • Union error.jpg
    Union error.jpg
    91.4 KB · Views: 94
:confused:
well i'm still quite stuck. I've narrowed it down to the three queries. One is a normal select query that pulls all the data. The two crosstabs are what I need to be unioned but can't make the next leap to get them to match up. If anyone with Higher Access Power! than me can take a quick look I'd really appreciate.

I've slimmed it down to just the necessary data. My ideal "look" is in the excel above.
 

Attachments

ended up combining the two desired fields. Not pretty but functional. :)
 
with the data file you provided, based on the initial ID, the union works.

Code:
SELECT *
FROM qreportforNealCrosstabFltTime
UNION
SELECT *
FROM qreportforNealCrosstabMaxofLesson
If you need a certain set of fields, do you need to display 86 cols? then in the properties tab of each crosstab, you can indicate the specific fields you would like in the column headings and that way they should match up regardless of if the fields don't exist in one or the other table. Alternatively, if you use the sql view on the cross tab, then you would add the col headings as follows...

On the "PIVOT" line type In (field, field, field) like below:

PIVOT qreportforNealCombined.LessonNum In (1,2,3,4);

Only the fields specified will show up.
 

Users who are viewing this thread

Back
Top Bottom