Good afternoon
MS Access 2007
I have the following select statement
strSql = “Select ” & sTable & “.* ”
strSql = strSql & “FROM ” & sTable & Chr(32)
strSql = strSql & “WHERE ” & sQFld & Chr(32)
strSql = strSql & “=” & Chr(32) & sFrm
This yields the following select statement with debug.print
Select tblcontacts.* FROM tblcontacts WHERE tblcontacts.ContactId = [forms]![frmContactEdit]![ContactId]
The create queryDef statement below works and behaves as expected
Set qdf = db.CreateQueryDef(“qry”, strSql)
However the attempt to open the recordset fails with error, too few parameters, expected 1
Set rs2 = db.OpenRecordset(“qry”, dbOpenDynaset)
When I stop the code I can manually select and execute the query successfully.
What am I doing wrong?
Regards
Geof