Hey everyone.. I have two tables, newTable and newTable2, I am trying to append newTable into newTable2.. They both have the same column names so I thought it would be cake.. If possible I would like it to remove duplicates also.. The code I have is

CurrentDb.Execute "INSERT INTO newTable2 " _
        & "SELECT * " _
        & "FROM newTable;"

I thought that would do the trick but I'm Making mock first names and they are not coming up in the newTable2.. Any ideas would be great.. Thankss

Assuming that the field names are firstName and Age this query will only insert the values that are in newTable and not in NewTable2

"INSERT INTO newTable2 (firstName, Age) " _
& "SELECT T1.firstName, T1.Age " _
& "FROM newTable2 AS T2 RIGHT JOIN newTable AS T1 ON T2.firstName = T1.firstName " _
& "WHERE (((T2.firstName) Is Null));"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.