I am working on a Totals query which will show our current inventory of each part# by lot#. That is to say it will show me how many I have on hand for each lot# when I have more than one lot of any part# in stock. My design involves recording inventory when it goes on the shelf and then recording it when it ships. Then when we need to know an on-hand quantity just subtract one from the other. I can get an overall quantity but have hit a wall in dividing that quantity into separate lot#'s when this exists. I've tried about every way I know how but just can't seem to get this one nailed down.
Any help would be greatly appreciated.
Table Structure: 2 tables
-tblReceiveDetail-
ProductID
LotNumber
Quantity
-tblShipDetail-
ProductID
LotNumber
Quantity
Receive Query:
SELECT tblReceiveDetail.ProductID, Sum(tblReceiveDetail.Quantity) AS SumOfQuantity
FROM tblReceiveDetail
GROUP BY tblReceiveDetail.ProductID
HAVING (((tblReceiveDetail.ProductID)=[Forms]![frmTotalQtyOnHand]![Text2]));
Ship Query:
SELECT tblShipDetail.ProductID, Sum(tblShipDetail.Quantity) AS SumOfQuantity
FROM tblShipDetail
GROUP BY tblShipDetail.ProductID
HAVING (((tblShipDetail.ProductID)=[Forms]![frmTotalQtyOnHand]![Text2]));
On Hand Query:
SELECT qryReceiveTotal.ProductID, ([qryReceiveTotal]![SumOfQuantity])-([qryShipTotal]![SumOfQuantity]) AS Expr1
FROM qryReceiveTotal INNER JOIN qryShipTotal ON qryReceiveTotal.ProductID = qryShipTotal.ProductID;
Any help would be greatly appreciated.
Table Structure: 2 tables
-tblReceiveDetail-
ProductID
LotNumber
Quantity
-tblShipDetail-
ProductID
LotNumber
Quantity
Receive Query:
SELECT tblReceiveDetail.ProductID, Sum(tblReceiveDetail.Quantity) AS SumOfQuantity
FROM tblReceiveDetail
GROUP BY tblReceiveDetail.ProductID
HAVING (((tblReceiveDetail.ProductID)=[Forms]![frmTotalQtyOnHand]![Text2]));
Ship Query:
SELECT tblShipDetail.ProductID, Sum(tblShipDetail.Quantity) AS SumOfQuantity
FROM tblShipDetail
GROUP BY tblShipDetail.ProductID
HAVING (((tblShipDetail.ProductID)=[Forms]![frmTotalQtyOnHand]![Text2]));
On Hand Query:
SELECT qryReceiveTotal.ProductID, ([qryReceiveTotal]![SumOfQuantity])-([qryShipTotal]![SumOfQuantity]) AS Expr1
FROM qryReceiveTotal INNER JOIN qryShipTotal ON qryReceiveTotal.ProductID = qryShipTotal.ProductID;