IIF and Option Values

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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.
 
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]
 
Back
Top