IIF and Option Values

G

Guest

Is it possible to use an IIF in an Option Value? I have an Option Button
(Yes/No) on a form and I want to set the value to either 0 or 1 based on
whether or not another Option Button is on or off. Can I use a statement
such as :

=IIf([Correct1] = "1", "1", "0")

and have [Answer] be 1 or 0?

Thanks.
 
G

Guest

Yes/No (boolean) fields don't evaluate to 1 or 0, they evaluate to -1 (True)
or 0 (False), so you would need to use that in your syntax.

HTH
 
G

Guest

So why doesn't it work with =IIf([Correct1] = "-1", "-1", "0")

Beetle said:
Yes/No (boolean) fields don't evaluate to 1 or 0, they evaluate to -1 (True)
or 0 (False), so you would need to use that in your syntax.

HTH

roccogrand said:
Is it possible to use an IIF in an Option Value? I have an Option Button
(Yes/No) on a form and I want to set the value to either 0 or 1 based on
whether or not another Option Button is on or off. Can I use a statement
such as :

=IIf([Correct1] = "1", "1", "0")

and have [Answer] be 1 or 0?

Thanks.
 
R

raskew via AccessMonster.com

Boolean variables are stored as 16-bit (2-byte) numbers, not Text as you've
shown in your example.

Bob
So why doesn't it work with =IIf([Correct1] = "-1", "-1", "0")
Yes/No (boolean) fields don't evaluate to 1 or 0, they evaluate to -1 (True)
or 0 (False), so you would need to use that in your syntax.
[quoted text clipped - 11 lines]
 

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