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")))
Help with IIF statement
-
- Administrator
- Posts: 78668
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Help with IIF statement
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")
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
Hans
-
- 5StarLounger
- Posts: 627
- Joined: 03 Feb 2010, 15:02
Re: Help with IIF statement
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.
Maybe this isn't possible the way I have it. Maybe I should make a Medical Rating Method2 field?
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 Number | Client Name | Medical Rating Method | Vis Rating Method | Den Rating Method |
000141 | Ampco Pittsburgh Corporation | Steel Pensioner Major Medical | ||
000141 | Ampco Pittsburgh Corporation | ASO |
Last edited by HansV on 23 Feb 2011, 19:35, edited 1 time in total.
Reason: to present data in table format
Reason: to present data in table format
-
- Administrator
- Posts: 78668
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Help with IIF statement
The best design would be to have only one rating method field plus a rating type field:
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.
Client Number | Client Name | Rating Method | Rating Type |
000141 | Ampco Pittsburgh Corporation | Steel Pensioner Major Medical | Medical |
000141 | Ampco Pittsburgh Corporation | ASO | Medical |
000142 | Acme Inc. | Who knows | Vis |
000143 | ZZZ Company | Dunno | Den |
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 627
- Joined: 03 Feb 2010, 15:02
Re: Help with IIF statement
Thanks Hans. I reconfigured to your design and it works.