View Full Version : criteria of crosstab query obtained from dialog box


ivanteo
04-09-2002, 06:11 PM
i have a dialog box that has a dropdown list of values which is the criteria for my crosstab query but i can't seem to run the query, always getting a prompt that says that microsoft jet engine does not recognise the expression "[Forms]![name of form]![name of field]"
anybody can help me?

Pat Hartman
04-10-2002, 09:22 AM
Crosstab queries must have been written by a different Microsoft programmer than the rest of them becuse crosstabs are very picky about parameters and require SPECIFIC parameter definitions.

Open the query in QBE grid.
Right click on the grey background to bring up the properties dialog.
Choose the Parameters option.
Enter your parameter names and data types.

ivanteo
04-17-2002, 12:31 AM
thank you for your help! now my crosstab query works!
since crosstab query requires specific parameter definition does that mean that if my criteria in my crosstab query has a Or statement, ie [forms]![name of form]![name of field] Or [forms]![name of form]![name of field] Is Null , there is no way to get the query to run?
i tried to run my query but nothing appears when there is no input in the form, when supposedly it shld display all data from that field.
sorry to trouble!

Pat Hartman
04-17-2002, 04:00 PM
This should not be a problem provided that the field name is spelled properly. Try cut and paste for the form field name to be sure that it is IDENTICAL in all three places - once as the parameter name and twice in the query itself.

If it still doesn't work, try creating a simple select query that includes the criteria and parameter. Then rather than basing the crosstab on the table, base it on the new select query.

ivanteo
04-17-2002, 05:45 PM
thank you for your help!
i checked the field name of my form and ensured that they are identical in all three places but still i get nothing.
tried to do a select query and got nothing too! apparently, without including the parameter name, the select query works for displaying all values but doesn't when the parameter name is included.
it works okay with a specified input in the form field but what i want is to be able to show all values when input is null.
any ideas? really appreciate all your help!

Pat Hartman
04-17-2002, 06:42 PM
I played around with this problem for a while and I think it must be a bug. The criteria works perfectly in a regular query but will not work in a crosstab query or in a select query that the crosstab is based on even when you explicitly define a parameter. You can try the paid Microsoft help site. If it turns out to really be a bug, they won't charge for the help. That doesn't mean they'll fix it for you either. It will just get added to the bug list for the next release.

Or, if you don't want to take the risk, you'll have to code around the problem (which I fear you would have to do anyway). Create a second query with no selection criteria and then determine which to run based on whether or not something is selected from the combo.

Sorry, good luck.

ivanteo
04-18-2002, 12:48 AM
Thank you for your help!
i tried this method and it kind of helped.
instead of getting the input from a form, i get it from the parameter of the query(ie user input into parameter dialog box)
thank you again! http://www.access-programmers.co.uk/ubb/smile.gif