Hello - I am building some dynamic sql and I have a problem with a field I am reading from a database that contains a double quote that I am then trying to include in some dynamic sql to update another table.
Basically I have this problem:
create a recordset by selecting * from table A
loop through the recordset
assign the variable partnum to a field in the recordset
so at a point in this loop, my variable partnum will get this value: partnum = 12345 1/2"bulk
I am then trying to include this partnum variable in some dynamic sql:
strsql = "update tblparts set inventory = 3 where partnum = '" & partnum & "' and year = 2009"
so the net effect of my strsql variable is:
"update tblparts set inventory = 3 where partnum = '12345 1/2"bulk' and year = 2009"
The double quote in my part number is causing the dynamic sql to fail because it isn't expecting the double quote in the middle of the string.
Basically I have this problem:
create a recordset by selecting * from table A
loop through the recordset
assign the variable partnum to a field in the recordset
so at a point in this loop, my variable partnum will get this value: partnum = 12345 1/2"bulk
I am then trying to include this partnum variable in some dynamic sql:
strsql = "update tblparts set inventory = 3 where partnum = '" & partnum & "' and year = 2009"
so the net effect of my strsql variable is:
"update tblparts set inventory = 3 where partnum = '12345 1/2"bulk' and year = 2009"
The double quote in my part number is causing the dynamic sql to fail because it isn't expecting the double quote in the middle of the string.