Link to home
Create AccountLog in
Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Avatar of shieldsco
shieldsco🇺🇸

Access 2010 crosstab query with multiple columns
I need to create a crosstab query with multiple columns. I have attached the sample table and the format that I'm looking for. Thanks
Database1.accdb
Sample.PNG

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of crystal (strive4peace)crystal (strive4peace)

the sample data is missing the field that specifies location (ie: Nationwide, Irvine, and Kansas City)

Avatar of shieldscoshieldsco🇺🇸

ASKER

see attached
Database1.accdb

what you want to do cannot be done with a cross-tab query alone. What I would do is loop through the records using VBA for each location and write the results to Excel or Word -- and I would recommend Excel since formulas are easier -- and it can also pivot information.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of Dale FyeDale Fye🇺🇸

I would generally agree with Crystal, although you can create a crosstab query which would return headings like:

Nationwide|FY16     Nationwide|FY17         Nationwide|Variance     Irvine|FY16        Irvine|FY17       Irvine|Variance

The way to do this is to concatenate two field ([Location] & "|" & "[Year]) in the query column you designate as "Column Header".

However, this would probably involve generating the crosstab query against a union query, which is what you would need to compute the data for your [Variance] columns and to compute your Total Dispositions row at the bottom.

I don't have access to the database now (on my iPad), but will take a look at your later this evening.

Avatar of shieldscoshieldsco🇺🇸

ASKER

LVL48 - thanks sounds like a potential solution

SOLUTION
Avatar of crystal (strive4peace)crystal (strive4peace)

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

ASKER CERTIFIED SOLUTION
Avatar of Richard DanekeRichard Daneke🇺🇸

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.

Avatar of shieldscoshieldsco🇺🇸

ASKER

I did something similar.... Thanks

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.

Microsoft Access

Microsoft Access

--

Questions

--

Followers

Top Experts

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.