Syntax error baffling me

G

Guest

I am trying to run the procedure below and keep getting the error " Syntax
error (missing opoerator) in expression."

Access highlights this row:
rs.FindFirst Criteria

I am not sure what is wrong, can anyone help me out?
---------------------------------------------------------------------

Private Sub Form_Activate()
Dim db As DAO.Database, rs As DAO.Recordset, rs2 As DAO.Recordset
Dim strSQL As String, Criteria As String
Dim i As Integer

strSQL = "SELECT tblAccreditation.AccreditationID, " & _
"tblAccreditation.AccreditationFrench, " & _
"tblAgreementDetails.AgreementID " & _
"FROM tblAccreditation INNER JOIN tblAgreementDetails " & _
"ON tblAccreditation.AccreditationID =
tblAgreementDetails.AccreditationID " & _
"WHERE tblAgreementDetails.AgreementID= " &
[Forms]![frmAccreditationSelectFrench]!txtAgreementID

'MsgBox strSQL
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

For i = 0 To lstAccreditation.ListCount - 1
Criteria = "[AccreditationFrench] = '" & lstAccreditation.Column(1, i) &
"'"
'MsgBox Criteria
If Not rs.BOF Then
rs.FindFirst Criteria
If rs.NoMatch = False Then
lstAccreditation.Selected(i) = True
Else
lstAccreditation.Selected(i) = False
End If
End If
Next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top