That's to escape apostrophe signs usually in query strings. If you have a query string, let's say something like this:
name = "Lori"
sql = "select * from customers where name = ' " & name & " ' "
There won't be a problem. The sql statement, after it's been merged with the variable name will look like this:
select * from customers where name = ' Lori '
Which is a perfectly legit SQL statement. BUT if you had something like this:
name = "O'Neil"
sql = "select * from customers where name = ' " & name & " ' "
It would crap out because of that apostrophe sign in O'Neil. So the SQL statement will look like this:
select * from customers where name = ' O'Neil '
Which the database will think the apostrophe after the O is the end of the SQL statement and will wonder about the trailing "Neil" - how do you fix this? You escape the apostrophe sign by double it. So it would look like this:
select * from customers where name = ' O''Neil '
And that's why that replace function replaces single apostrophes with doubles.
samaru
a.k.a inscissor
Team Colleague
1,256 posts since Feb 2002
Reputation Points: 262
Solved Threads: 18