View Full Version : Filtering by a control causes error in crostab query


SunWuKung
08-13-2001, 02:08 AM
I have several queries embedded in each other and at one point one of them is filtered by a control on a form. The final query runs nicely if it is a simple select query but gives me an error message if I turn it into a crosstab query saying that the [control name] cannot be recognised as a valid field name or expression, although the contol is never used as one and anyway is several queries earlier. In the final query there are only three very ordinary columns that I can't find a way to turn into a crosstab query.

Could you tell me what might be causing the problem?

Thanks in advance.
SWK

[This message has been edited by SunWuKung (edited 08-13-2001).]

Pat Hartman
08-13-2001, 04:49 AM
Crosstab queries reqire that parameters be explicitly declared. Even though the parameter is not being supplied directly to the crosstab, this still might be the problem. Open the query that needs the parameter in QBE view, right click on the grey background to get the menu. Choose parameters and enter the name and type for each parameter making sure to enter the names exactly as they are used in the query.

SunWuKung
08-13-2001, 05:18 AM
Thanks Pat, it seems that you are right. If I only change the condition to an exact value instead of a control name the crosstab works. But than how could I filter the rows on which I want to run my crosstab query based on a control?
Is it realy impossible? Should I write code for that? What would you suggest to get around this problem.

Thanks.

SWK.

Pat Hartman
08-13-2001, 07:03 PM
You can put the control name in the parameter definition.

SunWuKung
08-14-2001, 12:47 AM
Thanks Pat, that was the solution.