View Full Version : Replacing Quotes


EndersG
02-06-2006, 01:16 PM
I getting hung up on using the FindFirst method when I attempt to located a name with quotes. For example:

Dim str as String
str = "O'Reilly"

rs.FindFirst "[Customer] = '" & str & "'"

I tried:

rs.FindFirst "[Customer] = '" & Replace(str,"'","''") & "'"

but it doesn't work.

It keeps returning a syntax error despite me using the Replace function. What am I doing wrong? Can anyone help?

Thanks.

pono1
02-06-2006, 04:19 PM
Try something like this...


Dim str As String
str = Replace("O'Reilly", "'", "''")
Me.RecordsetClone.FindFirst "[Customer] = " & "'" & str & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark


Regards,
Tim

EndersG
02-07-2006, 09:57 AM
Thansk pono1. Worked like a charm.