Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error message

Status
Not open for further replies.

sealahu

Programmer
Aug 5, 2003
16
US
I create a module function to run a query.

************************
Dim Db As Database
Dim RST As Recordset

Set Db = CurrentDb
Set RST = Db.OpenRecordset("qryTEST", dbOpenDynaset)
**********************

the query 'qryTEST' has a parameter, like

select * from account
where accountID = Forms!Form1!txtAccountID

I run the function through Clicking a button on the form.

GET error:

Too few Parameters. Expected 1 pointing to the line
Set RST = Db.OpenRecordset("qryTEST", dbOpenDynaset)

How to correct this error?
 
Does txtAccountID have a value in it when you click the button? Try creating a stored query and pasting your sql into it, can you run the query then?
 
Since you posted what doesn't seem like an exact cut and paste excerpt of your code, all I can see is missing syntax, but I don't know if that is from re-typing it?


Dim Db As Database
Dim RST As Recordset

Set Db = CurrentDb
qryTEST = "select * from account where accountID=" & Forms!Form1!txtAccountID
Set RST = Db.OpenRecordset("qryTEST", dbOpenDynaset)


The error "Too few Parameters. Expected 1" can mean something as small as a misspelled field. Irking, really.




Emmali
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top