UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> More Than 2 Possible Outcomes For An Iif Statement, Office 2007    
 
   
rcbarrieault
post Sep 29 2011, 07:05 AM
Post #1

UtterAccess Addict
Posts: 109
From: Western Maryland



Good Morning,

I have an IIF statement in my basic query to return an answer in a report for me. This gives me the ability to have a this or that answer. However, I have three items listed in that field. Right now my line reads:

Funddoc: iif([document]="Yes","Contract","Not Contract")

But I have in that field these possible answers:
Yes
No
Unspecified

How do I get the above statement to stop returning "Not Contract" when the answer is "Unspecified"?

I want "Yes" to answer "Contract".
I want "No" to answer "Not Contract".
I want "Unspecified" to just answer "Unspecified".

Thanks
Go to the top of the page
 
+
lemunk
post Sep 29 2011, 07:09 AM
Post #2

UtterAccess Member
Posts: 26



hi im Not a great Access user but i know how to code, sounds like u could use a nested IF,

Funddoc:iif([document] = "yes", "contract" , iif([document] = "no" , "no Contract", "unspec"))

reads like, IF the doc = yes then say contract, else IF doc says No then say no contract, else just say Unspec

Hope this helps

This post has been edited by lemunk: Sep 29 2011, 07:09 AM
Go to the top of the page
 
+
accesshawaii
post Sep 29 2011, 07:09 AM
Post #3

UtterAccess VIP
Posts: 4,599
From: From Hawaii - Now in Wisconsin...Am I Nuts?



You can do something like this.

TheResponse: IIf([document]="Yes","Contract",IIf([document]="No","Not Contract",IIf([document]="Unspecified","Unspecified",[document])))

This would cover all your bases for your 3 criteria. In the event that the field is none of those values then just the actual field value would be displayed.
Go to the top of the page
 
+
rcbarrieault
post Sep 29 2011, 07:30 AM
Post #4

UtterAccess Addict
Posts: 109
From: Western Maryland



Awesome guys. I just wasn't sure if I could do the nesting. Never tried. Thanks for your help, it's working.
Go to the top of the page
 
+
accesshawaii
post Sep 29 2011, 08:57 AM
Post #5

UtterAccess VIP
Posts: 4,599
From: From Hawaii - Now in Wisconsin...Am I Nuts?



Glad you got it working.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 08:24 AM