how to set the check box's checked/unchecked value to different value?

F

Flora

Hi,

Does anyone know how to set the Check box or option button's value? In Access database, the default checked value(yes) is -1, and the default unchecked vaulue(no) is 0. I wanna change the checked value to 1, and unchecked value to -1. How to do that?

Thanks!
 
S

Steve Schapel

Flora,

You can't control the values used by a Yes/No data type field. If you
want to use different values in another context, you will need to make a
calculated field in a query, or a calculated control on your form or
report, something like this...
IIf([YourYesNoField]=0,-1,1)
 
F

fredg

Hi,

Does anyone know how to set the Check box or option button's value?
In Access database, the default checked value(yes) is -1, and the
default unchecked vaulue(no) is 0. I wanna change the checked value
to 1, and unchecked value to -1. How to do that?

Thanks!

Is the Check Box used as stand-alone control, or is it used within an
Option Group as a selection control?

1) As a stand-alone True/false control?
Why would you want to. Why does it matter? You can't!

A Check Box is either True, Yes, or On (-1) or False, No, or Off (0).

If working with the -1 value is creating a problem, let us know what
the problem is and perhaps we can help with that.

2) Used as a control within an Option Group (instead of the usual
radio buttons)?
Set the Check control's Option Value to what ever you want.
The Option Group will get it's value from the selected control's value
within the group, i.e. 1, 2, 3, etc.
 

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