To start, I am fairly new to Access and databases in general. I am trying to design a database which will allow my company to precisely track items as they come through our shipping, receiving, and inspection areas. Currently, I have a linked Excel sheet which gets updated daily via a company data extract. I then run an update query to append only new records to the database primary table. The table fields to append are: Part_Number, Lot_Number, Item_Description, PO_Number, ProjectID, Project_Name, Quantity, Reason_Code, and Dock_Receipt_Date.
The Issue I am having is that there can be multiple records with any combination of same-valued fields with a minimum of one field that makes them distinct (no true duplicate records exist in the Excel sheet), and when the update query runs, all records with same-valued fields become true duplicates. That is, the first update query, when the db is empty, appends all distinct records. During the second and subsequent updates, records with the same part number, or lot number, or PO number...even though they are distinct...get overwritten and become duplicates. I am wondering if there is a way to preserve the distinct records with an update query while appending new records to the db; or if there is a way to only append new records, ignoring existing ones?
As a note, I have tried adding an index to the Excel sheet, but when I run the update query, the database grows by hundreds of records as it's treating the Excel records as new each time.
P.S. The current SQL is:
UPDATE [Tbl 01 RDM DB]
RIGHT JOIN [Tbl 02a Pending Inspection Items]
ON [Tbl 01 RDM DB].Part_Number = [Tbl 02a Pending Inspection Items].Part_Number
SET [Tbl 01 RDM DB].Lot_Number = [Tbl 02a Pending Inspection Items].[Lot_Number]
, [Tbl 01 RDM DB].Part_Number = [Tbl 02a Pending Inspection Items].[Part_Number]
, [Tbl 01 RDM DB].Item_Desc = [Tbl 02a Pending Inspection Items].[Item_Desc]
, [Tbl 01 RDM DB].PO_Number = [Tbl 02a Pending Inspection Items].[PO_Number]
, [Tbl 01 RDM DB].[Project/CID] = [Tbl 02a Pending Inspection Items].[Project/CID]
, [Tbl 01 RDM DB].Dock_Receipt = [Tbl 02a Pending Inspection Items].[Dock_Receipt]
, [Tbl 01 RDM DB].Reason_Code = [Tbl 02a Pending Inspection Items].[Reason_Code]
, [Tbl 01 RDM DB].QTY = [Tbl 02a Pending Inspection Items].[QTY]
, [Tbl 01 RDM DB].Project_Name = [Tbl 02a Pending Inspection Items].[Project_Name];