Struggling to understand some of the post on this issue, I think this is the closest example that I found, Access query expression builder is creating duplicate rows in query, please help.. However I am not 100% sure because some records produce the correct query results and no duplicate rows. My first query is simple with one inner join looking for "PurchaseOrderNo" in two tables (I can post SQL if needed). I am assuming the second query is my problem, can anyone see if I need to add another query to elimanate some of the records? SQL below
The highlighted records are examples of some of the records that are duplicated, however in the next example the records only produce one row for the unique "PurchaseOrderNo", I dont know if it is because that particular PO only has one line on it so it doesn't meet all the criteria for access to create more than one result?
SQL:
SELECT Lapco_PO1.PurchaseOrderDate, Lapco_PO1.PurchaseOrderNo, IIf(IsNull(PO068_MXPPOTierDistribution!QuantityOrdered),([Lapco_PO1]!QuantityOrdered),PO068_MXPPOTierDistribution!QuantityOrdered) AS [Qty Ordered], Lapco_PO1.ItemCode, PO068_MXPPOTierDistribution.LotSerialNo, IM068_MXPUnivProdCode.UpcCode, Lapco_PO1.ShipToName, Lapco_PO1.ShipToAddress1, Lapco_PO1.ShipToAddress2, Lapco_PO1.ShipToAddress3, Lapco_PO1.ShipToCity, Lapco_PO1.ShipToState, Lapco_PO1.ShipToZipCode, Lapco_PO1.ShipToCountryCode, Lapco_PO1.FOB, Lapco_PO1.ShipVia, Lapco_PO1.UDF_USEREMAIL, Lapco_PO1.DateCreated, Lapco_PO1.TimeCreated, Lapco_PO1.Hour, TimeSerial([Lapco_PO1]!Hour,[Lapco_PO1]!Minute,[Lapco_PO1]!Seconds) AS [Order Time], Lapco_PO1.LineKey
FROM (Lapco_PO1 LEFT JOIN PO068_MXPPOTierDistribution ON (Lapco_PO1.ItemCode = PO068_MXPPOTierDistribution.ItemCode) AND (Lapco_PO1.PurchaseOrderNo = PO068_MXPPOTierDistribution.PurchaseOrderNo)) LEFT JOIN IM068_MXPUnivProdCode ON (PO068_MXPPOTierDistribution.ItemCode = IM068_MXPUnivProdCode.ItemCode) AND (PO068_MXPPOTierDistribution.LotSerialNo = IM068_MXPUnivProdCode.LotSerialNo)
ORDER BY Lapco_PO1.LineKey DESC , Lapco_PO1.PurchaseOrderNo DESC;
The highlighted records are examples of some of the records that are duplicated, however in the next example the records only produce one row for the unique "PurchaseOrderNo", I dont know if it is because that particular PO only has one line on it so it doesn't meet all the criteria for access to create more than one result?