K
kolbep
Hi Guys.
Me again.
I am busy with a stock control database.
I have several tables, the ones that I am having a problem with are as
follows:
tbl_Stock - Stock Descriptions, reorder levels, etc
tbl_Invoicing - When items are booked out of stock
tbl_GrvItems - The specific items that are received
tbl_GrvSuppliers - Lists what supplier, their Inv num, etc.
I Have a query that is supposed to give me the current stock levels
(Here is the SQL)
---------
SELECT tbl_Stock.Description, Sum(tbl_GrvItems.Qty) AS GRV,
Sum(tbl_Invoicing.Qty) AS Inv,
Sum(Nz([tbl_GrvItems].[Qty])-nz([tbl_Invoicing].[Qty])) AS Onhand
FROM tbl_GrvItems RIGHT JOIN (tbl_Invoicing RIGHT JOIN tbl_Stock ON
tbl_Invoicing.StockItem = tbl_Stock.StockID) ON tbl_GrvItems.StockItem =
tbl_Stock.StockID
GROUP BY tbl_Stock.Description;
---------
But now it seems I have a problem when I have Invoiced out say 2 of an Item,
and then later 1 of that item. The query sums get totally wrong the Inv:Qty
does its sums wrong and says 4 of that item have been booked out.
Please Help
I will send any more info you need
Thanks
Peter
--- news://freenews.netfront.net/ - complaints: (e-mail address removed) ---
Me again.
I am busy with a stock control database.
I have several tables, the ones that I am having a problem with are as
follows:
tbl_Stock - Stock Descriptions, reorder levels, etc
tbl_Invoicing - When items are booked out of stock
tbl_GrvItems - The specific items that are received
tbl_GrvSuppliers - Lists what supplier, their Inv num, etc.
I Have a query that is supposed to give me the current stock levels
(Here is the SQL)
---------
SELECT tbl_Stock.Description, Sum(tbl_GrvItems.Qty) AS GRV,
Sum(tbl_Invoicing.Qty) AS Inv,
Sum(Nz([tbl_GrvItems].[Qty])-nz([tbl_Invoicing].[Qty])) AS Onhand
FROM tbl_GrvItems RIGHT JOIN (tbl_Invoicing RIGHT JOIN tbl_Stock ON
tbl_Invoicing.StockItem = tbl_Stock.StockID) ON tbl_GrvItems.StockItem =
tbl_Stock.StockID
GROUP BY tbl_Stock.Description;
---------
But now it seems I have a problem when I have Invoiced out say 2 of an Item,
and then later 1 of that item. The query sums get totally wrong the Inv:Qty
does its sums wrong and says 4 of that item have been booked out.
Please Help
I will send any more info you need
Thanks
Peter
--- news://freenews.netfront.net/ - complaints: (e-mail address removed) ---