ADO's Find method (once again.)
Hi Mike,
In this example:
recordset.Find "FIELD = 'MyVar'"
What is the correct syntax for replacing the literal string, "MyVar," with
a
variable?
I've tried every way I could think of, and I always get a syntax error as
the result.
A workaround is to fully specify the argument in advance, e.g.
Dim str As String
' if MyVar is a String:
str = Chr(34) & "Field ='" & Chr(34) & MyVar & Chr(34) & "'" & Chr(34)
' if MyVar is numeric:
str = Chr(34) & "Field ='" & MyVar & "'" & Chr(34)
rs.Find str
HTH,
Merjet
|