Using a VBA module I am getting a runtime error "3061 Too few parameters expected 1"
when the last line of code below is executed
The critical elements are
Dim rst1 as DAO.recordset
Dim rst2 as DAO.recordset
Dim strSQL as String
Dim numID as Long
Set dbs = CurrentDb
Set rst1 = dbs.OpenRecordset("qryA", dbOpenDynaset)
...
strSQL = "SELECT tblA.Field1, tblB.Field2
FROM tblA INNER JOIN tblB ON tblA.Field3 = tblB.Field3
WHERE tblA.Field1 = numID ;"
Set rst2 = dbs.OpenRecordset(strSQL)
...
numID is being generated correctly earlier from rst1 and if I substitute a
number into the SQL statement directly the program functions fine.
I have managed similar coding with dates and string as as parameters but am stumped
here where the parameter is a number
when the last line of code below is executed
The critical elements are
Dim rst1 as DAO.recordset
Dim rst2 as DAO.recordset
Dim strSQL as String
Dim numID as Long
Set dbs = CurrentDb
Set rst1 = dbs.OpenRecordset("qryA", dbOpenDynaset)
...
strSQL = "SELECT tblA.Field1, tblB.Field2
FROM tblA INNER JOIN tblB ON tblA.Field3 = tblB.Field3
WHERE tblA.Field1 = numID ;"
Set rst2 = dbs.OpenRecordset(strSQL)
...
numID is being generated correctly earlier from rst1 and if I substitute a
number into the SQL statement directly the program functions fine.
I have managed similar coding with dates and string as as parameters but am stumped
here where the parameter is a number