Hello:
I have created a query which tracks items that are checked out and purchased from stock. I have a purchasetype tbl which identifies they type of transactions. 1-3 deduct from stock, while 4 (indicates an item that was checked out is checked back in) adds to stock.
I have created a query which sums the stock quantities (AcqDetail Qry).
SELECT Sum(StockTake.stockQuantity) AS SumOfstockQuantity, StockTake.stockTakeDt, StockTake.productID
FROM Acq INNER JOIN (AcqDetail INNER JOIN StockTake ON (AcqDetail.acqDetailID = StockTake.acqDetailID) AND (AcqDetail.acqDetailID = StockTake.acqDetailID) AND (AcqDetail.productID = StockTake.productID)) ON Acq.AcqID = AcqDetail.acqID
GROUP BY StockTake.stockTakeDt, StockTake.productID
ORDER BY StockTake.productID;
I have another query that sums quantity taken out of stock by the transaction (that deduct from stock) by item (CheckedOutQry).
SELECT [Check InOut].empID, [Check InOut].productID, Sum([Check InOut].checkOutQuantity) AS qtycheckedout, [Check InOut].purchasetypeID
FROM PurchaseType INNER JOIN [Check InOut] ON PurchaseType.purchasetypeID = [Check InOut].purchasetypeID
GROUP BY [Check InOut].empID, [Check InOut].productID, [Check InOut].purchasetypeID
HAVING ((([Check InOut].purchasetypeID) Not In (4)));
I would like to add an expression to this query to make any purchasetypes 1-3 a negative number, otherwise assign that as a positive number.
Expr1: IIf([PurchaseType].[purchasetypeID]<=3,[CheckedOutQry]![qtycheckedOut]*-1,([CheckedOutQry]![qtycheckedOut]))
I have been unable to accomplish this as I am always being prompted to enter the [CheckedOutQry]![qtycheckedOut], which in my mind is already being passed to this qry by the checkedoutqry or I have received a message telling me I have tried to execute a query that does not include the specified expression 'IIf([PurchaseType].[purchasetypeID]<=3,[CheckedOutQry]![qtycheckedOut]*-1,([CheckedOutQry]![qtycheckedOut]))' as a part of an aggregate function.
My overall goal is to use these two queries to create a UNION so that I may calculate the Amount On hand of an item.
I appreciate any light you can shed on this.
I have created a query which tracks items that are checked out and purchased from stock. I have a purchasetype tbl which identifies they type of transactions. 1-3 deduct from stock, while 4 (indicates an item that was checked out is checked back in) adds to stock.
I have created a query which sums the stock quantities (AcqDetail Qry).
SELECT Sum(StockTake.stockQuantity) AS SumOfstockQuantity, StockTake.stockTakeDt, StockTake.productID
FROM Acq INNER JOIN (AcqDetail INNER JOIN StockTake ON (AcqDetail.acqDetailID = StockTake.acqDetailID) AND (AcqDetail.acqDetailID = StockTake.acqDetailID) AND (AcqDetail.productID = StockTake.productID)) ON Acq.AcqID = AcqDetail.acqID
GROUP BY StockTake.stockTakeDt, StockTake.productID
ORDER BY StockTake.productID;
I have another query that sums quantity taken out of stock by the transaction (that deduct from stock) by item (CheckedOutQry).
SELECT [Check InOut].empID, [Check InOut].productID, Sum([Check InOut].checkOutQuantity) AS qtycheckedout, [Check InOut].purchasetypeID
FROM PurchaseType INNER JOIN [Check InOut] ON PurchaseType.purchasetypeID = [Check InOut].purchasetypeID
GROUP BY [Check InOut].empID, [Check InOut].productID, [Check InOut].purchasetypeID
HAVING ((([Check InOut].purchasetypeID) Not In (4)));
I would like to add an expression to this query to make any purchasetypes 1-3 a negative number, otherwise assign that as a positive number.
Expr1: IIf([PurchaseType].[purchasetypeID]<=3,[CheckedOutQry]![qtycheckedOut]*-1,([CheckedOutQry]![qtycheckedOut]))
I have been unable to accomplish this as I am always being prompted to enter the [CheckedOutQry]![qtycheckedOut], which in my mind is already being passed to this qry by the checkedoutqry or I have received a message telling me I have tried to execute a query that does not include the specified expression 'IIf([PurchaseType].[purchasetypeID]<=3,[CheckedOutQry]![qtycheckedOut]*-1,([CheckedOutQry]![qtycheckedOut]))' as a part of an aggregate function.
My overall goal is to use these two queries to create a UNION so that I may calculate the Amount On hand of an item.
I appreciate any light you can shed on this.