Problem:
I want to view all records with an actual quantity below a set level.
T-Parts - Item description, Stock level
T-Transactions - date of all transactions
T-TransactionDetails - Master Number(FK), transtype, quantity
T-TransTypes - type, result (positive or negative 1 depending on addition or deletion to stock levels)
The query(ies) need to find all parts with a current stock level > 0. Done.
Then, calculate the actual quantity for each record, be it 100 or 3000.
When I try to include an expression: Quantity * Result on the same query that selects the parts, I get errors about displaying a certain field or that the query does not include the specified expression Quantity * Result as part of an aggregate function.
The SQL that provides this error is:
The SQL that selects the parts:
Attached is a picture of the relationships showing the parts table also.
I want to view all records with an actual quantity below a set level.
T-Parts - Item description, Stock level
T-Transactions - date of all transactions
T-TransactionDetails - Master Number(FK), transtype, quantity
T-TransTypes - type, result (positive or negative 1 depending on addition or deletion to stock levels)
The query(ies) need to find all parts with a current stock level > 0. Done.
Then, calculate the actual quantity for each record, be it 100 or 3000.
When I try to include an expression: Quantity * Result on the same query that selects the parts, I get errors about displaying a certain field or that the query does not include the specified expression Quantity * Result as part of an aggregate function.
The SQL that provides this error is:
Code:
PARAMETERS prmDate DateTime;
SELECT [Quantity]*[Result] AS ActualStock, [T-TransactionDetails].MasterID_FK
FROM [T-TransTypes] INNER JOIN ([T-Transactions] INNER JOIN [T-TransactionDetails] ON [T-Transactions].TransID = [T-TransactionDetails].TransID_FK) ON [T-TransTypes].TransTypeID = [T-TransactionDetails].TransTypeID_FK
WHERE ((([T-Transactions].TransDate)>=[prmDate]))
GROUP BY [T-TransactionDetails].MasterID_FK;
The SQL that selects the parts:
Code:
SELECT [T-Parts].MasterNum, [T-Parts].Item, [T-Parts].WinterLevel
FROM [T-Parts]
WHERE ((([T-Parts].WinterLevel)>0))
ORDER BY [T-Parts].MasterNum;
Attached is a picture of the relationships showing the parts table also.