Run Crosstab Query without a Paramater Prompt

J

jrmfzf

I have a form that has data based on a crosstab query. I've added a
parameter on the form and into the query that filters the data. The
only problem I'm having is that everytime I open the form I'm prompted
to enter the paramter before the query can run and populate the form.
What I want to do is have the query run a default value when the form
is opened, so that when I change the value on the form I can requery it
and the data is updated. Right now it's a Catch 22 because I can't run
the query without the form open, but I can't open the form without the
query having been run. Looking forward to your help.
 
J

John Spencer

Have you declared your parameter types?

With a crosstab query you MUST declare your parameters and if any
other queries are used in the crosstab their parameters must also be
declared.

Open the query in design mode
Select Query: Parameters from the Menu
Fill in the EXACT name of the parameter in column 1
Select the data type of the parameter in column 2
 
J

jrmfzf

Yeah, I have everything declared correctly. It's just a matter of
giving a default value to the parameter before the forms is opened.
This seems like it might be something that could be done with some
code. My Visual Basic is pretty rusty, but I would think that there is
some way that I could give the parameter a value automatically when the
form is opened rather than having the query prompt me to do so.
Thanks.
 
D

Duane Hookom

I believe when the form is opened, it needs to find all the field names.
This suggests the crosstab must be run and it is asking for the parameter.

I would enter all the possible column headings into the Column Headings
property.
 
Top