I can't get this to work IIf function work for me

erict

Registered User.
Local time
Yesterday, 19:19
Joined
Sep 10, 2007
Messages
10
I have an expression in one column of my query and It keeps returning a negative result and there are no negative numbers in the source data. Can anyone help. I just want to sum the sums the two IIf expressions, but its not working. Thanks


Other Qty: Sum(IIf([QSum]![ACCOUNT]=2 And [QSum]![ICUNIT]=95 And [QSum]![UNITS]="ITEM(S)",[QSum]![QUANT],Null)) Or Sum(IIf([QSum]![ACCOUNT]=2 And [QSum]![ICUNIT]=100 And [QSum]![UNITS]="ITEM(S)",[QSum]![QUANT],Null))
 
Try changing the two Nulls to 0 and the Or to +

^
 
It works. Thanks for the tip. Can I ask how to add another series of IIf statements. Below is the revised original statement (1), & directly underneath the revised original, is another (2) of the many statements I need to add to get the results. Thank you for the advice.

(1) Other Qty: Sum(IIf([QSum]![ACCOUNT]=2 And [QSum]![ICUNIT]=95 And [QSum]![UNITS]="ITEM(S)",[QSum]![QUANT],0))+Sum(IIf([QSum]![ACCOUNT]=2 And [QSum]![ICUNIT]=100 And [QSum]![UNITS]="ITEM(S)",[QSum]![QUANT],0))

(2) Or Sum(IIf([QSum]![ACCOUNT]=3 And [QSum]![ICUNIT] In (2,100) And [QSum]![UNITS]="FEET") And [QSum]![Matl]<>0,[QSum]![QUANT],0))
 
Again change the Or to +

Other Qty: Sum(IIf([QSum]![ACCOUNT]=2 And [QSum]![ICUNIT]=95 And [QSum]![UNITS]="ITEM(S)",[QSum]![QUANT],0))+Sum(IIf([QSum]![ACCOUNT]=2 And [QSum]![ICUNIT]=100 And [QSum]![UNITS]="ITEM(S)",[QSum]![QUANT],0)) + Sum(IIf([QSum]![ACCOUNT]=3 And [QSum]![ICUNIT] In (2,100) And [QSum]![UNITS]="FEET") And [QSum]![Matl]<>0,[QSum]![QUANT],0))

^
 
Thank you for the help. Have a good week.
 

Users who are viewing this thread

Back
Top Bottom