Crosstab Query Criteria

S

Susan

Can a textbox on a form be referenced as the criteria for a field in a crosstab
query? When I use an expression like Forms!PFrmCriteria!Criteria, an error
message appears saying Access can not recognize 'Forms!PFrmCriteria!Criteria' as
a field or expression. However, if I put in the actual value of the criteria in
the crosstab query, the query runs fine.

Thank you!

Susan
 
M

MGFoster

Susan said:
Can a textbox on a form be referenced as the criteria for a field in a crosstab
query? When I use an expression like Forms!PFrmCriteria!Criteria, an error
message appears saying Access can not recognize 'Forms!PFrmCriteria!Criteria' as
a field or expression. However, if I put in the actual value of the criteria in
the crosstab query, the query runs fine.

The form the query's parameter is reading must be open & have a valid
value in the control.
 
M

MacDermott

For a cross-tab query, the references must be declared explicitly.
Use the little dialog box under Query - Parameters.

HTH
- Turtle

Susan said:
Can a textbox on a form be referenced as the criteria for a field in a crosstab
query? When I use an expression like Forms!PFrmCriteria!Criteria, an error
message appears saying Access can not recognize
'Forms!PFrmCriteria!Criteria' as
 
J

John Vinson

Can a textbox on a form be referenced as the criteria for a field in a crosstab
query? When I use an expression like Forms!PFrmCriteria!Criteria, an error
message appears saying Access can not recognize 'Forms!PFrmCriteria!Criteria' as
a field or expression. However, if I put in the actual value of the criteria in
the crosstab query, the query runs fine.

For any query you *can* specify the query's Parameters collection; for
a Crosstab query you *must* do so.

Right mouseclick the grey background of the tables and select
Parameters from the menu you'll see. Add the Forms!... reference (copy
and paste it from the criteria line, it must match precisely) and
specify the datatype (date, number, whatever).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top