OptionValue Property

Applies To

Check Box control, Option Button control, Toggle Button control.

Description

Each control in an option group has a numeric value that you can set with the OptionValue property. When the control is selected, the number is assigned to the option group. If the option group is bound to a field, the value of the selected control's OptionValue property is stored in the field.

For example, this Region option group is bound to the Region field in a table. The Europe button has an OptionValue property setting of 1, the Asia button has a setting of 2, and the Africa button has a setting of 3. When one of these buttons is selected, the Region option group value will be the same as the OptionValue property setting for the selected control. In this case, because the Region option group is bound to the Region field, the value of this field in the table also equals 2.

Note The OptionValue property applies only to the check box, option button, and toggle button controls in an option group.

Setting

The OptionValue property holds a Long Integer value or numeric expression assigned to a control within an option group control.

You can set the OptionValue property by using the control's property sheet, a macro, or Visual Basic.

Remarks

Unless you change the OptionValue property yourself, the first control you place in an option group has a value of 1, the second control has a value of 2, and so on.

The OptionValue property is only available when the control is placed inside an option group control. When a check box, a toggle button, or an option button isn't in an option group, the control has no OptionValue property. Instead, each such control has a ControlSource property, and the value of each control will be either True (–1) if selected or False (0) if not selected.

See Also

Controls collection, ControlSource property, TripleState property.