There are multiple problems with the examples here. The first one is:
Code:
"UPDATE additems" & _
"SET client
There is no space between linefeeds, and will throw a syntax error.
Second, this code:
Code:
"UPDATE additems SET client = Replace(client, " & strOld & "," & strNew & ")"
may not work for a number of reasons. Typically, you use this syntax:
Code:
"statement = '" & stringVar & "'"
to concat a string variable into a string statement like SQL, but doing that inside of an actual function I don't think it necessary. E.G. - this might be fine:
Code:
"UPDATE additems SET client = Replace(client, strOld, strNew)"
on the other hand, it might not be, and you might have to concat them out anyway:
Code:
"UPDATE additems SET client =
Replace(client, '" & strOld & "' , '" & strNew & "')"
and you may even have to add the brackets to be technically correct, as I'm not sure if vb always cares for them missing (the builder does accept, but vb I don't know):
Code:
"UPDATE additems SET [client] =
Replace([client], '" & strOld & "' , '" & strNew & "')"
and as a matter of fact, the last example given, when printed in the immediate window with actual string variables, returns:
Code:
UPDATE additems SET [client] =
Replace([client], 'String1', 'String2')
Which of course is correct, thus it should run fine in visual basic.