Recordset problem

polina

Registered User.
Local time
Today, 23:03
Joined
Aug 21, 2002
Messages
100
Hi

I am trying to open the recordset:
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("bill1")

And get an error "TOO FEW PARAMETERS"

"bill1" is a query where I prompt a user to enter the criteria.

What could solve the problem?

THanks
 
You can't open a recordset based on a query that requires parameter values, without actually passing the parameter values before opening the recordset.

Where will the parameter values come from? Do you still want the user to enter them, or should the values be taken from the form?

If you want the user to enter the values, you need to use the InputBox function to collect the input from the user, add the parameters to the query def, then open the recordset based on the querydef. This coding is definitely not for the faint of heart.

I'll work on a sample and try to explain how the code works.
 
thanks a lot

i figured that i can't open a recordset that prompts for the parameter.

so what i did is i first ran the query, put the result into the temporary table and then opened that table as a recordset

thanks again

good luck
 
Go Pat! Beat me to the punch.

To implement prompting the user for values
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim qd As DAO.QueryDef
Set dbs = CurrentDb
Set qd = dbs.QueryDefs!qryQCMainSizeCheck
qd.Parameters![YourParm1] = InputBox("Enter YourParm1")
qd.Parameters![YourParm2] = InputBox("Enter YourParm2")
Set rst = qd.OpenRecordset
 

Users who are viewing this thread

Back
Top Bottom