Syntax error on Access Insert SQL Statement

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

I am trying to use the following Access statement to insert records from one table into another if the data isn't already there. I am getting a syntax error on the following statement. The "SET" is highlighted on the error
INSERT INTO TABLE2
SET Table2.Col1 = Table1.Col1,
Table2.Col2 = Table1.Col2,
Table2.Col3 = Table1.Col3
WHERE NOT IN Table1.Col1(SELECT Col1 FROM Table2)
AND NOT IN Table1.Col2(SELECT Col2 FROM Table2)
AND NOT IN Table1.Col3(SELECT Col3 FROM Table2)

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Try

INSERT INTO TABLE2(Col1,ol2,Col3)
Select Col1,ol2,Col3 From Table1
WHERE NOT IN Table1.Col1(SELECT Col1 FROM Table2)
AND NOT IN Table1.Col2(SELECT Col2 FROM Table2)
AND NOT IN Table1.Col3(SELECT Col3 FROM Table2)
Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
Thanks very much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial