Stumped on "INSERT INTO..." command

Mendel

Registered User.
Local time
Today, 06:12
Joined
Jan 18, 2001
Messages
34
My code is comparing 2 tables, a Master Data table and a Raw Data table to find any discrepancies between them. Then I create an output table "TableDiscrepancies" to display the discrepancies.

In the beginning of my code I delete a table: dbs.TableDefs.Delete "TableDiscrepancies"
and then re-add it: dbs.Execut("CREATE TABLE TableDiscrepancies(Field1 TEXT, Field2 TEXT);")

and this works fine. Then I run the body of the code that does the checks between the tables. If there is a discrepancy then I set variables Field1 as the key and Field2 as the Field with the Discrepancy.

Now I want to output this to "TableDiscrepancies" and I've written the code like this:

dbs.Execute("INSERT INTO TableDiscrepancies(Field1)" & "The discrepancy is " & Field2"
wink.gif


This obviously is incorrect because I'm getting a Syntax error and it doesn't work and I'm having trouble finding how to write it correctly and make it work. Can anyone show me the err of my ways? Thanks for any assistance.

[This message has been edited by Mendel (edited 12-12-2001).]
 
I could be off here, but I think your quotation marks are off the mark.

Instead of
dbs.Execute("INSERT INTO TableDiscrepancies(Field1)" & "The discrepancy is " & Field2"

have you tried:
dbs.Execute("INSERT INTO TableDiscrepancies(Field1) & 'The discrepancy is ' & Field2"
 
Thanks for the advice. I changed it to read:

dbs.Execute("INSERT INTO Table(Field1)" & "VALUES("' & Field1 & '");")

Works great now!
smile.gif
 

Users who are viewing this thread

Back
Top Bottom