Crosstab Query Criteria

  • Thread starter Thread starter Susan
  • Start date Start date
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
 
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.
 
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
 
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).
 
Back
Top