SELECT tblLotDetail.StorageLocation AS Location, Sum(tblLotDetail.Cases) AS Cases, Last(tblLotDetail.PaletteID) AS PaletteID, Last(tblLotDetail.LotHeaderID) AS LastOfLotHeaderID, Last(tblLotHeader.CustomerItemID) AS CustomerItemID
FROM (tblLotDetail LEFT JOIN tblMovingLocationsTemp ON tblLotDetail.StorageLocation = tblMovingLocationsTemp.Location) LEFT JOIN tblLotHeader ON tblLotDetail.LotHeaderID = tblLotHeader.ID
WHERE (((tblLotDetail.LotHeaderID)=[forms]![frmMovingLocations]![frmsubmovinglocations]![LotHeaderID]) AND ((tblMovingLocationsTemp.Location) Is Null))
GROUP BY tblLotDetail.StorageLocation
ORDER BY tblLotDetail.StorageLocation;
|