I have a question regarding a previous post--using recordset as query criteria?
I have a form with several combo boxes corresponding to the fields in a query. The idea is that when a user clicks on the "Find" button on the form, the selections they have made in the combo boxes will be passed to a parameter query.
I came up with the following code based on the above post:
Dim db As Database
Dim qd As QueryDef
Dim rs As Recordset
Set db = CurrentDb
Set qd = db.QueryDefs("qselVariable")
qd.Parameters("Manufacturer") = Forms!frmVariable!cboMFR
Set rs = qd.OpenRecordset
However, when I run this code I receive the following error message:
Run-time error '3061':
Too few parameters. Expected 20.
When I click on debug, the Set rs = qd.OpenRecordset line is the line causing the error.
I am using Access 97 in a windows 98 environment.
Any help with this wuold be much appreciated!!
I have a form with several combo boxes corresponding to the fields in a query. The idea is that when a user clicks on the "Find" button on the form, the selections they have made in the combo boxes will be passed to a parameter query.
I came up with the following code based on the above post:
Dim db As Database
Dim qd As QueryDef
Dim rs As Recordset
Set db = CurrentDb
Set qd = db.QueryDefs("qselVariable")
qd.Parameters("Manufacturer") = Forms!frmVariable!cboMFR
Set rs = qd.OpenRecordset
However, when I run this code I receive the following error message:
Run-time error '3061':
Too few parameters. Expected 20.
When I click on debug, the Set rs = qd.OpenRecordset line is the line causing the error.
I am using Access 97 in a windows 98 environment.
Any help with this wuold be much appreciated!!