SQL record count / recordset
I need help with this problem. I have some code that has to run if I have records that have specific criterias. I don't need to get the list of records, just need to know if the record count is 0 or not.
Here is the code I have.
Dim rec As Recordset
Dim db As Database
Dim strSQL As String
strSQL = "SELECT COMMANDES.RefCommande " & _
"FROM ((COMMANDES INNER JOIN COMMANDESDetails ON COMMANDES.IdCommande = COMMANDESDetails.IdCommande) INNER JOIN MASTERSHOW ON COMMANDESDetails.IdMaster = MASTERSHOW.IdMaster) INNER JOIN RESUME ON MASTERSHOW.IdEvenement = RESUME.IdResume " & _
"WHERE RESUME.CodeEvenement)= " & [parmResume] & "AND " & "COMMANDES.StatutDepenses= 0 ;"
Set db = CurrentDb()
Set rec = db.OpenRecordset(strSQL, dbOpenDynaset)
If rec.RecordCount > 0 Then ...
When I run this code, I get a message stating "not enough parameters... 1 expected". When I step through my code, I get this message at the "set rec = db.openrecordset..."
Can anyone help me with this please ... :(