If you're using Access 97, which doesn't have a built in
replace
function ( I don't think), you'll need to place the following
code into
a module.
Public Function Replace(ByRef strText As String, strSearch As
String,
strReplace As String) As String
Dim lngStrPos As Long
lngStrPos = InStr(1, strText, strSearch)
Do While lngStrPos <> 0
strText = Left$(strText, lngStrPos - 1) & strReplace
& Mid$(strText, lngStrPos + 1)
lngStrPos = InStr(1, strText, strSearch)
Loop
Replace = strText
End Function
-----Original Message-----
>From: Pardee, Roy E [SMTP:roy.e.pardee@l...]
>
>Look at the Replace() function--you can use that to double
up a single
>quote, which should render it acceptable. So for instance:
>
>From my debug window:
>
>?replace("roy's", "'", "''")
>roy''s
>
>HTH,
>
>-Roy
>
>-----Original Message-----
>From: Meredith Shaebanyan [mailto:merediths@p...]
>
> Disclaimer: I am not an access programmer of a vbs
programmer; I'm
>sure
>this question will sound dumb to some of the experienced
access vetrans
>on
>this list.
> Question: Is there a function to strip out invalid
characters such
>as "'"
>from queries:
> Background: It's for a web-based forum system. The
user fills out a
>text
>box with his text, and it appears on the page ( simialer to
weblogs such
>as
>slashdot ). Unfortunately, single quotes in queries cause an
ODBC error.
> Thanks in advance!
>
>