Reputation: 23
I am trying to sum "Order Qty" from a table in my Access database where "Material group name" equals "Generic Rx" through a Sum if formula
I am using:
Gen Ordered: SUM(IIF([Material group Name]=(Generic Rx).[Order Qty],0)
but I am getting an invalid syntax error at the Generic Rx expression
"Generic Rx" is value within the "Material group name" column
what is the best way to go about this? Thanks
Upvotes: 1
Views: 51977
Reputation: 112762
Your question is unclear as you don't explain us what the different elements are. If we assume that Generic Rx
is a query parameter and Order Qty
is a table column then your expression must be
Gen Ordered: Sum( IIF([Material group Name] = [Generic Rx], [Order Qty], 0) )
' | |
'Name of |<-------------- condition ------->| true-part false part
'result column
' IIF( <condition>, <result if true>, <result if false>)
Meaning: If Material group Name
equals Generic Rx
Then the result will be Order Qty
else it will be 0
.
Upvotes: 1
Reputation: 97131
SUM(IIF([Material group Name]=(Generic Rx).[Order Qty],0)
| | |
1 2 3
IIf
arguments.This should be closer ...
SUM(IIF([Material group Name]="Generic Rx",[Order Qty],0))
Upvotes: 2