Eric said:
I'm getting a syntax error using the findfirst
method using multiple criteria.
.FindFirst "LastName ='" & rstout!LastName & "'" & "
And FirstName = '" & rstout!FirstName & "'"
Does anyone see what i'm doing wrong here?
Looks OK to me. I'm wondering which name it failed on. If
the name has an apostrophe in it (e.g. O'Riley), you will
get that error because of the unbalanced ' marks. You could
try using " marks instead since they rarely occur in names.
..FindFirst "LastName =""" & rstout!LastName & _
""" And FirstName = """ & rstout!FirstName & """"
Otherwise, you'll have to use the Replace function to double
up the quotes use to enclose the names.
..FindFirst "LastName ='" & _
Replace(rstout!LastName, "'", "''") & _
"' And FirstName = '" & _
Replace(rstout!FirstName, "'", "''") & "'"
When these expressions get too difficult to analyze, add a
Debug.Print or MsgBox to display the result of all that
concatenation so you can see what ended up being used.