Question : Access 2K append query

I need some ideas on an append query to avoid duplicates. I need to append all records from tblB to tblA provided the field named [DCode] does not already exist in tblA. Any input would be appreciated!

Answer : Access 2K append query

First:  make sure to have a unique index on the Dcode field of the target table.   If Dcode is the primary key, you are ok, if not, then go to table design and add an index on that column and specify No Duplicates.  note: if the table already has duplicates, you will need to remove them first.   The no-dups index acts like a unique key and prevents duplicates, no matter what you do.

Next, add a condition to your append query:

Insert Into table1
   from select * from table2
    where table2.dcode not in (select dcode from table1)



Random Solutions  
 
programming4us programming4us