Help with IIF statement

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Help with IIF statement

Post by matthewR »

Access 2003

I have the following IIF statement but it is saying I have the wrong amount of arguments:

Indicator:IIF([Vis Rating Method]<> [Medical Rating Method] or IIf([Den Rating Method] <> [Medical Rating Method]or IIF([Den Rating Method]<>[Vis Rating Method],"Mixed","Not Mixed")))

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

Re: Help with IIF statement

Post by HansV »

You only need one IIf:

Indicator:IIf([Vis Rating Method]<>[Medical Rating Method] OR [Den Rating Method]<>[Medical Rating Method] OR [Den Rating Method]<>[Vis Rating Method],"Mixed","Not Mixed")

Alternatively:

Indicator:IIf([Vis Rating Method]=[Medical Rating Method] AND [Den Rating Method]=[Medical Rating Method],"Not Mixed","Mixed")
Best wishes,
Hans

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Re: Help with IIF statement

Post by matthewR »

Thanks Hans.
I have another question. I have three fields - Medical Rating Method, Den Rating Method and Vis Rating Method. When I group and bring everything up to the Client level, there could be more than one rating Method under the Medical Rating Method. If they are different, I want them to say "Mixed" also. Right now it is saying Not mixed when there is more than one rating under Medical.
Client NumberClient NameMedical Rating MethodVis Rating MethodDen Rating Method
000141Ampco Pittsburgh CorporationSteel Pensioner Major Medical
000141Ampco Pittsburgh CorporationASO
Maybe this isn't possible the way I have it. Maybe I should make a Medical Rating Method2 field?
Last edited by HansV on 23 Feb 2011, 19:35, edited 1 time in total.
Reason: to present data in table format

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

Re: Help with IIF statement

Post by HansV »

The best design would be to have only one rating method field plus a rating type field:
Client NumberClient NameRating MethodRating Type
000141Ampco Pittsburgh CorporationSteel Pensioner Major MedicalMedical
000141Ampco Pittsburgh CorporationASOMedical
000142Acme Inc.Who knowsVis
000143ZZZ CompanyDunnoDen
You could then create a totals query that groups by Client Number and counts the Rating Method field. If the count is > 1, it's mixed, otherwise not mixed.
Best wishes,
Hans

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Re: Help with IIF statement

Post by matthewR »

Thanks Hans. I reconfigured to your design and it works.