M
mattc66 via AccessMonster.com
Need some help. I have the below query that works well, except in the
following situations.
qryInsufficientStock
SELECT tblOrderDetail.OrderID, tblOrderDetail.ProductID, tblOrderDetail.
OrdQty, tblOrderDetail.ReqShipDate
FROM tblOrderDetail INNER JOIN qryInventory ON tblOrderDetail.ProductID =
qryInventory.ProductID
WHERE (((qryInventory.OnHand)<[tblOrderDetail].[OrdQty]));
qryOrdersThatCanShip
SELECT *
FROM tblOrders
WHERE (((Exists (Select OrderID FROM qryInsufficientStock as X WHERE X.
OrderID = tblOrders.OrderID))=False))
ORDER BY tblOrders.OrderDate;
First off I am trying to determine which orders cannot be filled based on my
current stock levels. The issue comes up when I have enough stock to fill
each order on its own, however I would not have enough stock to fill the
orders together.
Inventory On Hand for Widget#1 = 50
Order#1
Widget#1 OrderQty = 25
Order#2
Widget#1 OrderQty = 35
The above query would not list these order, because it thinks it can fill the
requirments. However it cannot fill them both. It can fill one or the other.
What I'd like to do is the fill the order that came in first. That would be
Order#1.
Does anyone have a suggestion on how I could handle this issue?
Thanks
Matt
following situations.
qryInsufficientStock
SELECT tblOrderDetail.OrderID, tblOrderDetail.ProductID, tblOrderDetail.
OrdQty, tblOrderDetail.ReqShipDate
FROM tblOrderDetail INNER JOIN qryInventory ON tblOrderDetail.ProductID =
qryInventory.ProductID
WHERE (((qryInventory.OnHand)<[tblOrderDetail].[OrdQty]));
qryOrdersThatCanShip
SELECT *
FROM tblOrders
WHERE (((Exists (Select OrderID FROM qryInsufficientStock as X WHERE X.
OrderID = tblOrders.OrderID))=False))
ORDER BY tblOrders.OrderDate;
First off I am trying to determine which orders cannot be filled based on my
current stock levels. The issue comes up when I have enough stock to fill
each order on its own, however I would not have enough stock to fill the
orders together.
Inventory On Hand for Widget#1 = 50
Order#1
Widget#1 OrderQty = 25
Order#2
Widget#1 OrderQty = 35
The above query would not list these order, because it thinks it can fill the
requirments. However it cannot fill them both. It can fill one or the other.
What I'd like to do is the fill the order that came in first. That would be
Order#1.
Does anyone have a suggestion on how I could handle this issue?
Thanks
Matt