Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with Crosstab Query 3

Status
Not open for further replies.

jdgreen

Technical User
Mar 21, 2001
144
US
I have a crosstab query that is based on another query (qryLMPMbyDay). The code for qryLMPMbyDay is:

SELECT tblLMPM.Plant, Sum(tblLMPM.Required) AS SumOfRequired, Sum(tblLMPM.Shipped) AS SumOfShipped, tblLMPM.Cause, tblLMPM.Date
FROM tblLMPM
WHERE (((tblLMPM.Date) Between [Forms]![frmMain]![frmReports].[Form]![Text21] And [Forms]![frmMain]![frmReports].[Form]![Text23]))
GROUP BY tblLMPM.Plant, tblLMPM.Cause, tblLMPM.Date;

It takes dates entered on a form and uses them for the criteria. This query works perfectly, but when I run a crosstab query based on this query, I get an error that "The Microsoft Jet database engine does not recognize '[Forms]![frmMain]![frmReports].[Form]![Text21]' as a valid field name or expression.
Here is that query:

TRANSFORM Sum(qryLMPMbyDay.SumOfRequired) AS SumOfSumOfRequired
SELECT qryLMPMbyDay.Plant, Sum(qryLMPMbyDay.SumOfRequired) AS [Total Of SumOfRequired]
FROM qryLMPMbyDay
GROUP BY qryLMPMbyDay.Plant
PIVOT Format([Date],"Long Date");

I have tried basing the crosstab query directly on the table and adding in the criteria there with the same result. I haven't used crosstab queries much so I'm confused.


John Green
 
Add this 2 lines before the TRANSFORM:
PARAMETERS [Forms]![frmMain]![frmReports].[Form]![Text21] DateTime,
[Forms]![frmMain]![frmReports].[Form]![Text23] DateTime;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top