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.
For what it is worth...
My xl97 openRecordSet help file show 4 arguments: (source, type, options, lockedits) for a database object.
The last three arguments are optional.
Try adding two commas after dbOpenSnapshot.
Portland, Oregon USA
(free and commercial excel programs)
Set rs = dbs.OpenRecordset("SELECT Centre_X, Centre_Y FROM [qry_all_details] WHERE ID = '" & siteID & "'", dbOpenSnapshot)
Notice I've added single quotes before and after the double quotes. If you still have problems, remove the WHERE clause. If no error returns, then there's a problem in the WHERE clause (I'd bet the WHERE is the problem).
Tiago Cardoso VB / VBA Analyst