Completely new to Access VBA so please be nice!
I have tblNew and tblTeam.
I want to loop through each record in tblNew to check if it already exists in tblTeam. The identifier is the email address. If the record does not exist then I want to add the record to tblX.
I'm stuck on searching to check if the record exists and how to loop through each record in the tblNew.
Apologies if I've duplicated any questions, I really couldn't understand or find what I was looking for.
SELECT tblNew.emailAddress FROM tblNew LEFT OUTER JOIN tblTeam ON tblNew.emailAddress = tblTeam.EmailAddress WHERE tblTeam.EmailAddress IS NULL GROUP BY emailAddressthat will give you a list of distinct email address intblNewthat isn'ttblTeamalready. Now stickINSERT INTO tblX (emailAddress) <that same SELECT statement>to insert them all at once. No loops and just on SQL statement will do this.