Just happened to be reading about this today. I'm not a devoloper and don't
really know if it applies to your situation, but maybe it might help.
JOhn
Public Function adhHandleQuotes(strValue As String, _
Optional strDelimiter As String = """") As String
' Fix up all instances of a quote within a string by
' breaking up the string, and inserting Chr$(34) whereever
' you find a quote within the string. This way, Jet can
' handle the string for searching.
' From Access 2000 Developer's Handbook, Volume I
' by Getz, Litwin, and Gilbert. (Sybex)
' Copyright 1999. All Rights Reserved.
'
' Solution suggested by Jurgen Welz, a diligent reader.
' In:
' strValue: Value to fix up.
' strDelimiter: (Optional) Delimiter to use.
' Out:
' Return value: the text, with delimiters fixed up.
' Requires:
'
' Example:
' adhHandleQuotes("John ""Big-Boy"" O'Neil") returns
' "John " & Chr$(34) & "Big-Boy" & Chr$(34) & " O'Neil"
Dim strInsert As String
strInsert = "Chr$(" & Asc(strDelimiter) & ")"
adhHandleQuotes = _
strDelimiter & _
Replace(strValue, strDelimiter, _
strDelimiter & " & " & strInsert & " & " & strDelimiter) & _
strDelimiter
End Function
<ja********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
History:
Took over development of Access project after half of app was
developed. Continued the second half using same coding style as first
developer, but improved upon code and flow, etc. Almost all of the
insertions and deletions were done as DoCMD.RunSQL strSQL.
Our current problem:
All of our prototyping for the business tool was done in with
insertions and deletions, as above, without regard to the problem
introduced by apostrophes.
Rather than rewrite code, I considered using a replace function to
intelligently replace apostrophes with accent marks (underneath tilde).
There are more complex ways of handling this problem, but most require
extensive reworking of existing code.
Any ideas?