IIf Help!!!

F

Fia

How can I use an IIf function if I wan't to have 3 diffrent answers.
I'll will try to explain whet I mean.

If the value is neither True or False then I want to give the value of Ord
back.
I can't use the code below, because if Ord is another value than True or
False for example a string, "Hej", I'll get 0 back from the IIf-function. I
know I can use an if and else statement, but not in this case.
IIf(Ord=True,-1,0)

Please help

Fia
 
G

Guest

Use a nested IIF as below to return -1 if true, 0 if false or 2 if neither
true nor false
IIf(Ord=True,-1,IIf(Ord=False,0,2))
 
J

John Vinson

How can I use an IIf function if I wan't to have 3 diffrent answers.
I'll will try to explain whet I mean.

If the value is neither True or False then I want to give the value of Ord
back.
I can't use the code below, because if Ord is another value than True or
False for example a string, "Hej", I'll get 0 back from the IIf-function. I
know I can use an if and else statement, but not in this case.
IIf(Ord=True,-1,0)

What's the datatype of Ord? If it's an Access Yes/No field then True
(-1) and False (0) are the only values that it CAN have!

John W. Vinson[MVP]
 

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