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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String with single quote (Quotation mark) 1

Status
Not open for further replies.

kayek

Programmer
Jun 19, 2003
95
US
How do you handle a SQL command that uses a string that has a single quote in it?

For Example:

OldName = "Jone's Company"
NewName = "Jone's House"

SQL = "UPDATE table SET Name = '" & NewName & '" _
"WHERE Name = '" & OldName & ';"

docmd.runsql SQL

I get a syntax error.
 
Hi

Use two apostrophes together, eg:

OldName = "Jone''s Company"

For a double quote, use the same technique - put two together. eg

strString = "Fred said ""Hello"""

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top