Whenever I try to run/execute a query/SQL from code which has a WHERE clause, I get a runtime errors , "Too Few Parameters. Expected 1."
I have dumbed the above code down. I just want to be able to loop through the records (at this point) but every time I introduce the 'where' I get the 'too few parameters error
In the immediate window delivers the goods
eg. SELECT * from APClientTasksToProcessQry WHERE ClientId = 1 ORDER BY APId, APStepId
ANY Ideas would be helpful
Would I be better to funnel the record set into this where I don't need the 'WHERE' statement.
Thanks
Atrium
Code:
Dim strSQL As String
Dim db As Database
Dim RecCounter As Integer
Dim rs As Recordset
DBEngine.SetOption dbMaxLocksPerFile, 1000000
Set db = CurrentDb
strSQL = "SELECT * from APClientTasksToProcessQry WHERE ClientId = " & [Forms]![OpenClientTasksFrm]![ClientIdFld] & " ORDER BY APId, APStepId"
Set rs = db.OpenRecordset(strSQL)
RecCounter = 1
Do While Not rs.EOF
MsgBox "Record number " & RecCounter
' Deliver the precedent doc to create, create it and pick up the next task
RecCounter = RecCounter + 1
rs.MoveNext
Loop
rs.Close
I have dumbed the above code down. I just want to be able to loop through the records (at this point) but every time I introduce the 'where' I get the 'too few parameters error
In the immediate window delivers the goods
eg. SELECT * from APClientTasksToProcessQry WHERE ClientId = 1 ORDER BY APId, APStepId
ANY Ideas would be helpful
Would I be better to funnel the record set into this where I don't need the 'WHERE' statement.
Thanks
Atrium