This documentation is archived and is not being maintained.

OptionValue Property [Access 2003 VBA Language Reference]

Office 2003

Each control in an option group has a numeric value that you can set with the OptionValue property. Read/write Long.


expression Required. An expression that returns one of the objects in the Applies To list.


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.

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

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 if selected or False if not selected.


The following example sets the OptionValue property for three option buttons in the "Ship Method Group" option group when a form opens. When an option button is selected in the option group, a message displays indicating the shipper's assigned ID number.

Private Sub Form_Open(Cancel As Integer)
    Me.Controls("ABC Couriers").OptionValue = 15876
    Me.Controls("Speedy Delivery").OptionValue = 742
    Me.Controls("Lightning Express").OptionValue = 1256
End Sub
Private Sub Ship_Method_Group_Click()
    MsgBox "The ID for the selected shipper is " & 

Me.Controls("Ship Method Group").Value

End Sub