Rabu, 01 Februari 2017

[MS_AccessPros] Append Query Does not work

 

I have imported a table from an existing spreadsheet.  I am just trying to use the records in the table to append new rows to an existing table, tblProductFamilies.  The table created from Excel has a field named ProductFamily.  there are many duplicate values in this field and also some of the field values are already in the tblProductFamilies.  I am just trying to get an append query to append new records to the tblProductFamilies where the ProductFamily in the imported table does not exist in the tblProductFamilies.

The table imported from Excel is named _tblImportTanks2.  The only field I need from that table at the moment is named ProductFamily.  It is short text.

I want to append to tblProductFamilies and it has fields:
   ProductFamily ID; primary key; autonumber
   ProductFamilyName: short text; indexed and unique
   Description; short text

I am using query design view and the SQL being generated is:
INSERT INTO lu_tblProductFamilies ( ProductFamilyName )
SELECT [_tblImportTanks2].ProductFamily
FROM _tblImportTanks2;

The query does not add any new records at all, "due to key violations".  I was expecting there to be about 15 new records created which did not previously exist in tblProductFamilies, and the rest (about 160 records) to be rejected due to key violations.  Instead, all are being rejected.

Can you help me with what I am doing wrong? 


__._,_.___

Posted by: david.pratt@outlook.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar