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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab Query date range 1

Status
Not open for further replies.

lbigk

MIS
May 24, 2002
58
US
Hello,

I cannot figure out the issue with my query:

TRANSFORM Sum(tblProduction.ProdNbr) AS [The Value]
SELECT tblProduction.Task, tblProduction.UserID, Sum(tblProduction.ProdNbr) AS Total
FROM tblProduction
WHERE (((tblProduction.PDate) Between [Forms]![frmReports]![txtFrom] And [Forms]![frmReports]![txtTo]))
GROUP BY tblProduction.Task, tblProduction.UserID
PIVOT Format([PDate],"Short Date");

When I run this query, I get the following: "The Mircosoft Jet database engine does not recognize '[Forms]![frmReports]![txtFrom]' as a valid field name or expression."

If I use specific date range in the same WHERE statement, the query works correctly. The form with txtFrom and txtTo fields is loaded and fields are populated.

Any ideas?

Thank you.
 
You need to add a parameter. For example:

[tt]PARAMETERS [Forms]![frmReports]![txtFrom] DateTime,
[Forms]![frmReports]![txtTo] DateTime;
TRANSFORM Sum(tblProduction.ProdNbr) AS [The Value]
SELECT tblProduction.Task, tblProduction.UserID, Sum(tblProduction.ProdNbr) AS Total
FROM tblProduction
WHERE (((tblProduction.PDate) Between [Forms]![frmReports]![txtFrom] And [Forms]![frmReports]![txtTo]))
GROUP BY tblProduction.Task, tblProduction.UserID
PIVOT Format([PDate],"Short Date");[/tt]
 
Remou,

Thank you soooo much, it worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top