Compare and append

  • Thread starter Thread starter Johny
  • Start date Start date
J

Johny

Hi there!

I'm new to access vba development and perhaps you could help me in here:

I am comparing to tables (table1, table2). If it happens that there are
records which are in table1 that are *not* in table2 then I want to append
that record in table2.

Could someone explain me the code to achieve this?

Thank you ever so much!

Johnny
 
Johny said:
I'm new to access vba development and perhaps you could help me in here:

I am comparing to tables (table1, table2). If it happens that there are
records which are in table1 that are *not* in table2 then I want to append
that record in table2.

Could someone explain me the code to achieve this?


Assuming the primary key field in table1 is retained in
table2, just insert the new records using an unmatched type
query:

INSERT INTO table2
SELECT *
FROM table1 INNER JOIN table2
ON table1.pkfield = table2.pkfield
WHERE table2.pkfield Is Null
 
Back
Top