I have the following 'set recordset'
line that I cannot get working. The parameters seem correct according to all available help I can find on the subject.
The error displays :
"Run-time error '3061'. Too few parameters. Expected 1."
Here is the line of code:
Set rs = dbs.OpenRecordset("SELECT Centre_X, Centre_Y FROM [qry_all_details]
WHERE ID = " & siteID & ";", dbOpenSnapshot)
Where rs is the recordset (Dim rs As Recordset) and dbs = CurrentDb()
Any help would be appreciated.
I have tried removing the WHERE
cause with no effect, and also using single quotes between double quotes, but no joy.
Many thanks.
I got the same error with something like:
I fixed the error by replacing "Query1" with "Query2"
you have:
you need:
Note the extra quotations (
'
). . . this kills me everytimeEdit: added missing double quote
In my case, I got this error when I tried to use in a query a new column, which I added to MySQL table (linked to MS Access), but didn't refresh it inside MS Access.
To refresh a linked remote table:
In my case, I had simply changed the way I created a table and inadvertently changed the field name I tried to query. Make sure the field names you reference in the query actually exist in the table/query you are querying.
"Run-time error '3061'. Too few parameters. Expected 1."
I believe this happens when the field name(s) in your sql query do not match the table field name(s), i.e. a field name in the query is wrong or perhaps the table is missing the field altogether.
I got the same error message before. in my case, it was caused by type casting. check if siteID is a string, if it is you must add simple quotes.
hope it will help you.