Using a text box on a form to set the criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a text box in a form to set the criteria for one of the fields in
a crosstab query and get the following response "The Microsoft Jet database
engine does not recognize [Forms]![frmReports]![txtRegion] as a valid field
name or expresion." The section in [] works fine in all the other types of
query, but not in crosstab, why?
Is there any thing to do to get round this problem?
 
You must declare the parameter in a crosstab. It's a good idea in other
types, but essential for crosstab.

Open your query in design view.
Choose Parameters on the Query menu.
In the dialog enter:
[Forms]![frmReports]![txtRegion] Text
or whatever type is appropriate.
 
Chase said:
I am using a text box in a form to set the criteria for one of the
fields in a crosstab query and get the following response "The
Microsoft Jet database engine does not recognize
[Forms]![frmReports]![txtRegion] as a valid field name or expresion."
The section in [] works fine in all the other types of query, but not
in crosstab, why?
Is there any thing to do to get round this problem?

Most queries in Access will resolve form references on the fly. The resolution
process involves making a "best guess" as to the data type based on the valuue
found in the form control.

Crosstab queries insist that all parameters (including form references) be
explicitly entered into the parameters dialog box of the query. When entering
parameters this way you have to indicate the DataType of the parameter so that
Access doesn't have to figure it out on its own.
 
Back
Top