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

syntax error on replace statements

Status
Not open for further replies.

kdjonesmtb2

Technical User
Nov 19, 2012
93
US
Microsoft ODBC SQL Server Driver SQL Server incorrect syntax near '1'

Line 101: "conn.Execute(sqlFromHTrio)
dim sqlFromHTrio
For x = 1 to 15
sqlFromHTrio = replace(replace(replace(sqlFromHTrioTemplate, "$ROW$", cstr(x)),"$CD$", cptsearchtxt),"$QTY$",txt_procedure_quantity)



conn.Execute(sqlFromHTrio)
Next
 
what is the result of all the [tt]replace()[/tt]?

Code:
For x = 1 to 15
   sqlFromHTrio = replace(replace(replace(sqlFromHTrioTemplate, "$ROW$", cstr(x)),"$CD$", cptsearchtxt),"$QTY$",txt_procedure_quantity)
   msgbox sqlFromHTrio
Next

break it up to see where the error lies

Code:
For x = 1 to 15
   str1 = replace(sqlFromHTrioTemplate, "$ROW$", cstr(x))
   str2 = replace(str1,"$CD$", cptsearchtxt)
   str3 = replace(str2,"$QTY$",txt_procedure_quantity)
   msgbox str3
Next

-Geates

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top