As I said previously, the query must specify the names of the columns it is
returning An example of specifying the column names is shown below
CHECK the PIVOT line of the query.
TRANSFORM Sum(qry1DecReport.Amount) AS SumOfAmount
SELECT qry1DecReport.[CSA Account]
, FIND_CSA.from_fac
, FIND_CSA.from_site
, Sum(qry1DecReport.Amount) AS Total
FROM (tblDate LEFT JOIN qry1DecReport
ON tblDate.Month=qry1DecReport.Month_Yr)
LEFT JOIN FIND_CSA
ON qry1DecReport.[CSA Account]=FIND_CSA.csa_account
GROUP BY qry1DecReport.[CSA Account], FIND_CSA.from_fac, FIND_CSA.from_site
PIVOT tblDate.Month IN (1,2,3,4,5,6,7,8,9,10,11,12)
If tblDate.Month is a text field with the abbreviated names of the months,
then the in clause would have to have the month names
PIVOT tblDate.Month IN ("Jan","Feb",...,"Dec")
Try the above modification and see if that solves your problem.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
AccessUser30 said:
yes, but how can i correct this error?
TRANSFORM Sum(qry1DecReport.Amount) AS SumOfAmount SELECT
qry1DecReport.[CSA
Account], FIND_CSA.from_fac, FIND_CSA.from_site, Sum(qry1DecReport.Amount)
AS
Total FROM (tblDate LEFT JOIN qry1DecReport ON
tblDate.Month=qry1DecReport.Month_Yr) LEFT JOIN FIND_CSA ON
qry1DecReport.[CSA Account]=FIND_CSA.csa_account GROUP BY
qry1DecReport.[CSA
Account], FIND_CSA.from_fac, FIND_CSA.from_site PIVOT tblDate.Month;
John Spencer said:
You must be using a crosstab as a subquery. What the message says is
that you must specify the columns being returned in by the crosstab
query.
Transform
SELECT
FROM
PIVOT SomeField IN ("Column1Value","Column2Value","Column3Value")
The values are what you would expect to see as column headers if you ran
the crosstab by itself.
'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
AccessUser30 wrote:
:
how can i solve for this message? (Cannot use the crosstab of a
non-fixed column as a subquery)