Link to home
Start Free TrialLog in
Avatar of Bevos
Bevos

asked on

Changing output of IIf statement in SQL from -1,0 to a text value

Hello, I have the following nested IIf statement:
New Reviewed Item: IIf(([PPopulation] And [DDesign1] And [O1Outcome1]),True,IIf(([PPopulation] And [DDesign1] And [D2Design2] And [O2Outcome2] And [SP_YN]),True,IIf(([PPopulation] And [DDesign1] And [D2Design2] And [O2Outcome2] And Not [SP_YN] And ([NTotal]>=100)),True,False)))

Open in new window


which works very well and gives me the value -1 for true and 0 for false.  Instead of these values I would like to get the code INC for -1 and EXC for 0.  Can anyone show me how to modify this statement to get this effect?

Thanks so much,
Bevo
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try this

New Reviewed Item: IIf(([PPopulation] And [DDesign1] And [O1Outcome1]),True,IIf(([PPopulation] And [DDesign1] And [D2Design2] And [O2Outcome2] And [SP_YN]),True,IIf(([PPopulation] And [DDesign1] And [D2Design2] And [O2Outcome2] And Not [SP_YN] And ([NTotal]>=100)),"INC","EXC")))
ASKER CERTIFIED SOLUTION
Avatar of sshah254
sshah254

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bevos
Bevos

ASKER

Hi Capricorn, when I try that statement I get -1 still for true values and #Error when the value is 0.  The SQL code is accepted by the program however without error.
Avatar of Bevos

ASKER

That worked sshah :) thanks so much both of you for your comments.