Access Access 2010 import/append data into table w/o overwriting existing records


Joined
Feb 6, 2014
Messages
1
Reaction score
0
Sorry for the long question/post but need some help as I've been searching for several days but havent found anything that helps.

I have table1 in my (Access 2010) database that has exising records. I have another table2 that after I run a query, it first deletes the data in table 2, then imports the GAL from the exchange server. I run the import into table 2 on a semi regular basis but have yet to copy all those records into table 1 successfully.

I need to copy only the records from table 2 to table 1 if the records don't already exist in table1. I'd like to use the email field as a foreign key to ensure there are only new records to be added to table 1. Table 1 primary key is ID (autonumber)
So, each time the query or vba code would run, it would be continuing to grow table 1 without duplicating existing data.
The data that I'm trying to pull into table 1 from table 2 is:
lname,fname,phone,email

I have a small start of SQL but cannot get it to work properly because I'm not sure how to add the other fields into this SQL statement properly (unfortunately I don't know a whole lot about SQL or creating an append query) so any assist is greatly appreciated:
INSERT INTO [Current] ( FirstName ) SELECT DISTINCT tblglobaladdresslistimport.First FROM tblglobaladdresslistimport LEFT JOIN [Current] ON tblglobaladdresslistimport.First = Current.FirstName WHERE Current.FirstName Is Null;
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top