Bit of an odd one...
- I have a module which runs queries on linked sales spreadsheets, to merge them in to one Access table.
- To prevent duplication of sales, the primary key merges the sales record and item number fields.
Today, it's found 103 key duplication errors, which is fine. But it's still adding data to the table. The data seems to be fields which aren't even mentioned in the query. It only does this when the query is ran from VBA.
Query:
Records (example and incorrect data):
SalesRecord, SKU, Dropship, PostCode, Shipping, Quantity, SalePrice, Picked, SalesRecordSKU, DateAdded
310246702, 12017, BB54 4PZ, Standard, 1, £27.91, No, 31024670251017, 03/12/2013
colin88, , , PayPal, 29-Nov-13, , , No, colin88, 03/12/2013
- I have a module which runs queries on linked sales spreadsheets, to merge them in to one Access table.
- To prevent duplication of sales, the primary key merges the sales record and item number fields.
Today, it's found 103 key duplication errors, which is fine. But it's still adding data to the table. The data seems to be fields which aren't even mentioned in the query. It only does this when the query is ran from VBA.
Query:
Code:
MergeEbay = "INSERT INTO tblSales ( SalesRecord, SKU, PostCode, Shipping, Quantity, SalePrice, SalesRecordSKU, DateAdded )" & _
"SELECT exEbaySales.[Sales record number], IIf(exEbaySales.[Custom label] Is Null,'0',exEbaySales.[Custom label]), exEbaySales.[Buyer postcode], " & _
"IIf(exEbaySales.[Postage service] Like '*24*','Express',IIf(exEbaySales.[Postage service] Like '*48*','Standard',exEbaySales.[Postage service])), " & _
"exEbaySales.Quantity, exEbaySales.[Total price], exEbaySales.[Sales record number] & exEbaySales.[Custom label], Date() " & _
"AS DateAdded FROM exEbaySales;"
Records (example and incorrect data):
SalesRecord, SKU, Dropship, PostCode, Shipping, Quantity, SalePrice, Picked, SalesRecordSKU, DateAdded
310246702, 12017, BB54 4PZ, Standard, 1, £27.91, No, 31024670251017, 03/12/2013
colin88, , , PayPal, 29-Nov-13, , , No, colin88, 03/12/2013