Solved

Setting column headings for crosstab query causes error

Posted on 2012-03-29
3
399 Views
Last Modified: 2012-03-29
Experts,

I need to add a subform that is based on a crosstab query. This means I need to set the column headings in the query. However, when I do this, running the query produces the error message that says the expression is typed incorrectly or is too complex. It runs fine without the column headings being set.

At first I thought the problem may have something to do with the column headings being numeric, but changing them to text did not help.

Thanks, Dale

PARAMETERS [TempVars]![SelectedCrop] Long, [TempVars]![SelectedCountry] Long, [TempVars]![SelectedDriver] Long;
TRANSFORM Avg(qryExpertOpinionSub1.Decrease) AS AvgOfDecrease
SELECT tblProductMainGroups.ProductMainGroup AS Product, tblClasses.Class
FROM tblClasses INNER JOIN ((qryExpertOpinionSub2 LEFT JOIN qryExpertOpinionSub1 ON (qryExpertOpinionSub2.CropYear = qryExpertOpinionSub1.CropYear) AND (qryExpertOpinionSub2.ProductMainGroupID = qryExpertOpinionSub1.ProductMainGroup) AND (qryExpertOpinionSub2.ClassID = qryExpertOpinionSub1.ClassID)) INNER JOIN tblProductMainGroups ON qryExpertOpinionSub2.ProductMainGroupID = tblProductMainGroups.ProductMainGroupID) ON tblClasses.ClassID = qryExpertOpinionSub2.ClassID
GROUP BY tblProductMainGroups.ProductMainGroup, tblClasses.Class
PIVOT qryExpertOpinionSub2.CropYear In ("Product","Class",2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025);

Open in new window

0
Comment
Question by:dlogan7
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 37782412
Remove the columns "Product" and "Class" from the PIVOT IN () clause

PIVOT qryExpertOpinionSub2.CropYear In (2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025);
0
 

Author Comment

by:dlogan7
ID: 37783173
Duh..."column" heads. I've done it correctly before, just been a long time.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 37783212
glad I could help.  We've all been there!  ;-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question