If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > ADO INSERT/UPDATE problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-19-04, 15:35
Viggy Viggy is offline
Registered User
 
Join Date: Jan 2004
Posts: 18
ADO INSERT/UPDATE problems

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...

THanks,
Viggy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On