Nested Iif question

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Nested Iif question

Post by Egg 'n' Bacon »

I need some help with a calculation, it uses; Iif, And, Or.

What I need it to do is; calculate two fields together i.e. [Text137]*[sfrmConditionCOSHH]![txtFireScore]

But there will be times when [txtFireScore] will equal 0, but I need a value from [Text137]. These times are when [Volat] equals either "Powder" or "Below 56ºC"

Here is the current state of the calculation.

=IIf([Volat]="Powder" Or "Below 56ºC" And [sfrmConditionCOSHH]![txtFireScore]=0,[Text137],([Text137]*[sfrmConditionCOSHH]![txtFireScore]))

TIA

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Nested Iif question

Post by HansV »

And has precedence above Or. And you must repeat [Volat]=, so try

=IIf(([Volat]="Powder" Or [Volat]="Below 56ºC") And [sfrmConditionCOSHH]![txtFireScore]=0,[Text137],([Text137]*[sfrmConditionCOSHH]![txtFireScore]))
Best wishes,
Hans

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Nested Iif question

Post by Egg 'n' Bacon »

Ah, thank you Hans.

That did the trick.