I am importing an excel file XLImportToAccess and comparing with tblImportToAccess (production table).
It works fine.
I have to add additional criteria though.
If XLImportToAccess.DATE doesnt equal tblImportToAccess.DATE and all other fields match as shown in the append query below, then I need to update tblImportToAccess.DATE to the date found in field XLImportToAccess.DATE.
I hope that makes sense. Please let me know if I need to add something else.
INSERT INTO tblImportToAccess ([Trade #], [Buy CP], [Quantity BBLS], [Data], Batch, [Origin / Deal], [Date], Grade, State, [Trade #1], [Sale CP], [Operation #], WorkingDate, SentAwayDate, Notes)
SELECT XL.[Trade #], XL.[Buy CP], XL.[Quantity BBLS], XL.[Data], XL.Batch, XL.[Origin / Deal], XL.[Date], XL.Grade, XL.State, XL.[Trade #1], XL.[Sale CP], XL.[Operation #], XL.WorkingDate, XL.SentAwayDate, XL.Notes
FROM XLImportToAccess as XL LEFT JOIN tblImportToAccess as I2A
ON XL.[Trade #] = I2A.[Trade #]
AND XL.[Buy CP] = I2A.[Buy CP]
AND XL.[Quantity BBLS] = I2A.[Quantity BBLS]
AND XL.[Batch] = I2A.[Batch]
AND XL.[Date] = I2A.[Date]
WHERE I2A.ID IS NULL