UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Mysql And Apostrophe, Office 2010    
 
   
icemonster
post May 5 2012, 02:16 AM
Post #1

UtterAccess Veteran
Posts: 324



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?
Go to the top of the page
 
+
dipetete
post May 5 2012, 02:49 AM
Post #2

UtterAccess Guru
Posts: 857
From: Bogotá - Colombia



You can use Chr(34) (") instead of (').
Regards,
Diego
Go to the top of the page
 
+
niesz
post May 5 2012, 06:44 AM
Post #3

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



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, "'", "''") & "'



Go to the top of the page
 
+
icemonster
post May 5 2012, 10:18 AM
Post #4

UtterAccess Veteran
Posts: 324



worked like a charm, perfect.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 25th May 2013 - 08:23 AM