Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

embedded apostrophe 1

Status
Not open for further replies.

grndpa

Programmer
May 4, 2007
27
US
In an earlier post, rac2 and PHV helped me with the SQL format example.
Code:
sqlOut = "INSERT INTO tryit (myID) VALUES ('" & aEMPLID & "')"

This worked fine until I got to aEMPLID valued O'Shane (i.e. apostrophe embedded in the name).

I do have a function through which I run my string input. It checks for a null value, the word "null" (due to uncleansed data from another system) among other machinations. Is there something I could code into this function to take care of my embedded apostrophe problem?

(I do have a workaround that involves substituting a dollar sign for the apostrophe before posting, and reversing it upon retrieval, but that strikes me as having a high "stink" factor)

Regards,

Grnadpa Brian
 
Code:
sqlOut = "INSERT INTO tryit (myID) VALUES ('" & Replace(aEMPLID, "'", "''") & "')"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you.

Can you recommend a microsoft SQL reference? I never would have figured these out based on my experience with other sql encounters (DB2, mySQL). And Wiley Publishing's Access 2003 Bible doesn't cover these kind of details.

Thanks again!

Grnadpa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top