Recordset FindFirst Issues

R

RSMan

Hello,

I have a procedure that searches a table (recordset 1) for values in a
lookup table (recordset 2) using FindFirst / FindNext. The rotine worked fine
until recently, I now have two issues;

I have included a new country in the lookup table - Cote D'Ivoire, now I get
an error message when it reaches this name. I guess it's the ' that is
causing the problem but don't know how to get round it!!??

I have modified the program so I can select the field I want to search from
a form (thanks John) but it won't accept the field name as it's not part of
the recordset e.g. rstTempTable.findfirst "[Field] = etc. How can I pass the
chosen field from the form to the recordset?

Thanks in advance .....
 
S

Sergey Poberezovskiy

I use a function to get around such values in the SQL:

Public Function FixQuotes(ByVal value As String) As String
FixQuotes = Replace(Replace(value, Chr(34), Chr(34) &
Chr(34) & Chr(34)), Chr(39), Chr(39) & Chr(39))
End Function

HTH.
 
Top