too few parameters - Sub Query

D

Dianna

Hi,

I am running a query which references a subquery. the criteria in the
subquery is set to a value in the form (Forms!Results!cboSeason)

I am receiving the error: too few parameters. Can I use a forms value in a
subquery? When I take it out it works. So far, from what I read, it does
not seem that I will be able to use a forms value.... (?)

If I can't use it, can I set up a 'Global Variable' in Access?

Any help would be great,
Thanks,
Dianna
 
V

Vincent Johns

Dianna said:
Hi,

I am running a query which references a subquery. the criteria in the
subquery is set to a value in the form (Forms!Results!cboSeason)

I am receiving the error: too few parameters. Can I use a forms value in a
subquery? When I take it out it works. So far, from what I read, it does
not seem that I will be able to use a forms value.... (?)

It's not clear to me what you're trying to do. Do the Query and
subquery that form the data sources of the Form give you the values you
want without producing an error message when you run them apart from the
Form? You should be able to display them in Datasheet view with an
included subdatasheet.
If I can't use it, can I set up a 'Global Variable' in Access?

I'm not sure if mine is an approved method, but I do this by creating a
Table named something like [T_Parameters] with just one record in it
that consists of a bunch of fields.
 
V

Van T. Dinh

I got a feeling that you are "running" this Query in VBA code, e.g. using
VBA to create a Recordset based on this Query due to error message post.

If this is the case, you need to resolve the Parameter
Forms!Results!cboSeason to explicit value before passing the Query to JET
for execution since JET doesn't know about Access Forms or Controls on
Access Forms.

The same Query probably works fine if you run the Query through the Access
GUI. The reason is that there is an Expression Service working with the GUI
resolves the reference to the Form Control for you automatically in the GUI.
The Expression Service, however, does not involve with VBA code execution.
 
D

Dianna

Thank Van. Thats what I thought :(
Dianna

Van T. Dinh said:
I got a feeling that you are "running" this Query in VBA code, e.g. using
VBA to create a Recordset based on this Query due to error message post.

If this is the case, you need to resolve the Parameter
Forms!Results!cboSeason to explicit value before passing the Query to JET
for execution since JET doesn't know about Access Forms or Controls on
Access Forms.

The same Query probably works fine if you run the Query through the Access
GUI. The reason is that there is an Expression Service working with the GUI
resolves the reference to the Form Control for you automatically in the GUI.
The Expression Service, however, does not involve with VBA code execution.
 
Top