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

' symbol problem

Status
Not open for further replies.

svassiliev

Programmer
Jan 19, 2004
3
0
0
CZ
I have ' symbol in some names in table Cat. strName also can have 'symbol. Example: Smith's Mountain

At that case I can't open like this:
rsCheckMet.Open "SELECT * FROM Cat WHERE NAME='"& strName &"'", adoCon

How can I go around it?

Thanks in advance!
 
Replace the ' with '' so it flows in the SQL statement.

strName = Replace(strName,"'","''")

rsCheckMet.Open "SELECT * FROM Cat WHERE NAME='"& strName &"'", adoCon

HTH
 
Should be noted that '' above is two instances of the single quote ('), not the double quote(")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top