Still puzzled with iif statement in spite of help received

J

Jack

Hi,
I just got help on iif statement to handle null values. However I am
applying the concept from prototype to real system. I am using the following
to display Y if true(-1) and N (if false i.e. 0).

=IIf([AlloydRecommendedGuage] Is
Null,Null,IIf([AlloydRecommendedGuage],"Y","N"))

However, now most of the values should be N (as these are 0) instead I am
getting Y in all the rows for the above calculated field. This field in
backend connected sql server is int instead of smallint. I am not sure if
this datatype change has to do with the display though apparently it should
not. Thanks for any further help.
 
K

Klatuu

See if this does it:
=IIf([AlloydRecommendedGuage] Is
Null,Null,IIf([AlloydRecommendedGuage] = 0,"N","Y"))
 
A

Arvin Meyer [MVP]

Try:

IIf(IsNull([AlloydRecommendedGuage],Null,IIf([AlloydRecommendedGuage]=0,"N","Y")

The above says:

If it's null, leave it that way,
If it's false (0) make it "N"
If it's true (-1) make it "Y"

I put the "N' first because Access evaluates truepart then falsepart of the
expression (not the values).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top