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

SQL COMMON SYNTAX ERROR, HELP!!

Status
Not open for further replies.

bros

Programmer
Jul 14, 2000
57
MY
When I write the SQL common, I face a problem with the symbol "'", which same commond of SQL.
e.g
SQL = "SELECT * FROM TABLE1 WHERE FIELD1 = '" & RANGE1 & "'"

RANGE1 = "CH'NG AH TAN"

The "CH'NG" chr have "'", so SQL conflict with the sysmbol,
can anyone help me to solve this problem. OR just ask the user do not use the symbol "'"??

 
It is ok to use the tick, you just need to check for it when you are searching with that field.

Put this line in before the SQL.

RANGE1 = Replace(RANGE1 , "'", "''")

David Paulson


 
dpaulson, thanks for your help, but how do I to compare that FIELD1 with RNAGE1, because I cannot change the FILED1 data, am I right??

help!!!
 
No, you won't be changing the data in field1. You need to double up on the single ticks in order to pass it to the sql. Just try it. It will work fine.
David Paulson


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top