Create a pivot table based on a union query

vavs

Well-known Member
Joined
Jul 2, 2004
Messages
514
I created a union query in Access to join two tables (Projections and Actual Sales). The query produces the results I want. I need to create a pivot table in Excel using the union query as the source. When I pull up the data import function in Excel, the union query does not appear. Do I need to do something else? I have tried to create a select query where I select all from the union query and I can find that fine.

When I use this query to create the pivot table the results end up all zeros when I try to sum the values. It creates some crazy results when I show it as count of also.

I can provide anyone with the data in either the Access database or Excel spreadsheet
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
what version of excel do you have? I created a union query, and like you said, it doesn't show up. then I created a Select * Union query, and gave it a different name, and that one was listed, and I was able to bring it into excel with no problem
 
Upvote 0
I can do the same, but when I try to pivot off the information everything goes to zero or it counts things in the wrong columns. It is clearly an undocumented feature.
 
Upvote 0
I have a couple of suggestions:
1. Create a make table query using the Union Query as the source and then you can import the data from the new table into excel. You cannot convert a union query to a make table query. You must make a new query using the Union Query as the source.
or
2. Export the union query to excel from access and run your pivot table.

HTH

Alan
 
Upvote 0
Rule# 1- Do not use double quotes in your union query anywhere.
It may work in access but it will screw things up in the Jet data engine. It will also cause the "too few parameters" error.

Rule #2- Use ms query to create the pivot table. To do this go to the data tab--> from other sources --> from ms query. Choose ms access database. Select your query and data fields. Import Data into a pivot table.

For some reason union queries are not visible using the insert-->pivot table--> use external data range method.

Tip #1 - you can add your union query to a select query and then add other related data fields to the data set. If you have calculations to make, I advise you to do them in the select query. Calculated fields created inside the pivot table tool are subject to more restrictions.

Good luck

Toom21 (using excel2007+access2003)
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top