Log in

View Full Version : Solved: parameter declaration issue



Van Ieperen
09-24-2007, 05:44 AM
Gents,

It seems that I've ran into a parameter handling issue that I've not learned yet, and haven't been able to find.... (Pretty novice .....)

I try to run a selection query that selects records that contain three parameters the user can select from combo boxes on a form.

The form is a continues form of this query.
In the Query, I have the criteria set up as follows:

Like [Forms]![Changedata]![TxtDescription]
Where the TxtDescription refers to the first combo box.
(And so the two others.)
The form also contains a button to activate the Query. However, when I activate it, I get the error: Too few parameters, expected 3

The code of the button starts with:

Dim Rschangedata As Recordset
Set Rschangedata = CurrentDb.Openrecordset ("Changedata")

(Where Changedata is the name of the query)

The stupid thing is, when I write the SQL code into the VBA section of the form, it works the way it should, but I would like to use the query itself.

Can somebody help me with this???

Johan

OBP
09-24-2007, 05:58 AM
johan, are you putting the parameter in the Query's parameters or in the Criteria Row of the Query?
Why are you using a Recordset for the Query rather than displaying the query or a form based on it?

Van Ieperen
09-24-2007, 06:22 AM
I am putting the parameter in the criteria row of the query.

I use the recordset, because based on these three parameters, I select a specific record. Then I use the form also to make it possible to change other fields of this specific record.
(The combination of these 3 parameters results by definition in one record.)