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

Not recognizing as a valid expression? 1

Status
Not open for further replies.

Aximboy

Technical User
Aug 3, 2003
63
US
I have a query that filters the years based on a form input.

Here is how the filter looks like:
WHERE (((Format([Request Date],"yyyy"))=[Forms]![frmStatus]![txtStatusYear]));

When I click Run...
The query runs fine.
The union query runs fine.
However, the crosstab query gives me an error.

It says "The Microsoft Office Access database engine does not recognize '[Forms]![frmStatus]![txtStatusYear]' as a valid field name or expression.

Any suggestion on this?
 
You must declare the data type of parameters used in crosstab queries. Find Parameters in the query properties dialog. I would set the type to integer and change the where clause to:
SQL:
WHERE Year([Request Date])=[Forms]![frmStatus]![txtStatusYear];


Duane
Hook'D on Access
MS Access MVP
 
It works!!!
But it took me awhile to figure out how to use the Parameters properties dialog.
Again, thank you so much!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top