I have code that reads from an excel worksheet and automatically puts certain values into either an SQL update or insert statement.
for instance (i'm doing this quickly, any syntax error here isn't in the code):
SQLQUERY = "UPDATE " & tablename & vbcrlf & _
SQLQUERY = SQLQUERY & "SET " & fieldname1 & " = " & variable1 & vbcrlf & _
SQLQUERY = SQLQUERY & "WHERE " & fieldname2 & " = " & variable2
This code works when its dealing with boolean variables, and possibly numeric variable...
The problem is if either variable1 or variable2 is a string, then the code wants the single-quotations makes around the variable. FOr instance
UPDATE...... WHERE NAME = 'John'
Is there a way to get around this problem... otherwise, i need to have my code diferentiate between variables that require the quotation marks, and those that don't, which is extremely tedious, and ugly...