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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenRecordSet Error

Status
Not open for further replies.

Dummy99

Programmer
Apr 25, 2002
30
FR
My following code gives me error message:

"Too few parameters. Expected 1."

It appears to me to be from the last line of code but I don't understand it / can't resolve. Please help!

StrSQL = "SELECT Keywds,keyid,key FROM Keys WHERE Keyid = Forms!Info.Key"
Set qdf = dbs.CreateQueryDef("TempQuery", StrSQL)
Set rst = dbs.OpenRecordset("TempQuery")

My SQL statement result is:

SELECT keywds,keyid,key FROM Keys WHERE Keyid = Forms!Info.Key

and appears to be OK, i.e., my query is created OK.

Thanks,
Dummy99
 
Try this

StrSQL = "SELECT Keywds,keyid,key FROM Keys WHERE Keyid =" & Forms!Info.Key

I'm not familiar with the .Key property. If it's a string, you'll need to add quote marks like this:

StrSQL = "SELECT Keywds,keyid,key FROM Keys WHERE Keyid = '" & Forms!Info.Key & "'"
_________
Rott Paws

...It's not a bug. It's an undocumented feature!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top