Just when I think im finished, something else utterly confounds me!
I have 2 queries; one of which shows a list of all parts, the opening stock, how many have been issued, how many have been receipted and finally the current balance. In this query I am happy for the Current Balance to show zero's.
here is the SQL:
SELECT Inventory.WHLocatID, Inventory.PartID, Inventory.OpeningQty, Nz([qryTransLogTotal].[TotalReceipt],0) AS TotalReceipt, Nz([qryTransLogTotal].[TotalIssuance],0) AS TotalIssuance, [openingqty]+[totalReceipt]-[TotalIssuance] AS CurrentBalance
FROM Inventory LEFT JOIN qryTransLogTotal ON (Inventory.WHLocatID = qryTransLogTotal.Origin) AND (Inventory.PartID = qryTransLogTotal.PartID)
ORDER BY Inventory.PartID;
This works perfectly!
The second query is essentially the same BUT I do not want to display any records where the CurrentBalance is showing as zero. However when I run it, NO records are displayed at all and I really can't see why!
SQL:
SELECT Inventory.WHLocatID, Inventory.PartID, Inventory.OpeningQty, Nz([qryTransLogTotal]![TotalReceipt],0) AS TotalReceipt, Nz([qryTransLogTotal]![TotalIssuance],0) AS TotalIssuance, [openingqty]+[totalReceipt]-[TotalIssuance] AS CurrentBalance
FROM Inventory LEFT JOIN qryTransLogTotal ON (Inventory.WHLocatID = qryTransLogTotal.[Origin]) AND (Inventory.PartID = qryTransLogTotal.PartID)
WHERE ((([openingqty]+[totalReceipt]-[TotalIssuance])>0));
As you can see, apart from the ORDER BY function in the first query, and of course the WHERE function in the 2nd, everything is the same. If I remove the >0 then the query behaves exactly like the first.
my brain hurts!
many thanks as always
Chris
I have 2 queries; one of which shows a list of all parts, the opening stock, how many have been issued, how many have been receipted and finally the current balance. In this query I am happy for the Current Balance to show zero's.
here is the SQL:
SELECT Inventory.WHLocatID, Inventory.PartID, Inventory.OpeningQty, Nz([qryTransLogTotal].[TotalReceipt],0) AS TotalReceipt, Nz([qryTransLogTotal].[TotalIssuance],0) AS TotalIssuance, [openingqty]+[totalReceipt]-[TotalIssuance] AS CurrentBalance
FROM Inventory LEFT JOIN qryTransLogTotal ON (Inventory.WHLocatID = qryTransLogTotal.Origin) AND (Inventory.PartID = qryTransLogTotal.PartID)
ORDER BY Inventory.PartID;
This works perfectly!
The second query is essentially the same BUT I do not want to display any records where the CurrentBalance is showing as zero. However when I run it, NO records are displayed at all and I really can't see why!
SQL:
SELECT Inventory.WHLocatID, Inventory.PartID, Inventory.OpeningQty, Nz([qryTransLogTotal]![TotalReceipt],0) AS TotalReceipt, Nz([qryTransLogTotal]![TotalIssuance],0) AS TotalIssuance, [openingqty]+[totalReceipt]-[TotalIssuance] AS CurrentBalance
FROM Inventory LEFT JOIN qryTransLogTotal ON (Inventory.WHLocatID = qryTransLogTotal.[Origin]) AND (Inventory.PartID = qryTransLogTotal.PartID)
WHERE ((([openingqty]+[totalReceipt]-[TotalIssuance])>0));
As you can see, apart from the ORDER BY function in the first query, and of course the WHERE function in the 2nd, everything is the same. If I remove the >0 then the query behaves exactly like the first.
my brain hurts!
many thanks as always
Chris