Full Version: Mysql And Apostrophe
UtterAccess Discussion Forums > Microsoft® Access > Access Modules
icemonster
how to handle inserting a string with an apostrophe? i just realized this is actually a problem for me because some names have an apostrophe.

right now this is my value field in the insert:

'" & Me.txtlastname & "'

how to properly quote it to be able to insert a quotation or apostrophe properly?
dipetete
You can use Chr(34) (") instead of (').
Regards,
Diego
niesz
You'll need to double any existing quotes, so a RELPACE() function is needed.

If you are using VBA, something like:

CODE
'" & Replace(Me.txtlastname, "'", "''") & "'



icemonster
worked like a charm, perfect.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.