Applies To ActiveX control, Bound Object Frame control, Chart control, Check Box control, Combo Box control, List Box control, Option Button control, Option Group control, Tab control, Text Box control, Toggle Button control.
Description
You can use the Value property to determine or specify if a control is selected, the selected value or option within the control, or the text contained in a text box control.
Setting
The Value property uses the following setting depending on the specified control.
Control | Setting | Description | Visual Basic |
Check box | True False | The check box is selected. (Default) The check box is cleared. | True (–1) False (0) |
Combo box | [The text in the text box portion of the control] | This may or may not be the same as the setting for the Text property of the control. The current setting for the Text property is what is displayed in the text box portion of the combo box; the Value property is set to the Text property setting only after this text is saved. | |
List box | [The list box item value] | The value in the bound column for the item selected in the list. | |
Option button | True False | The option button is selected. (Default) The option button isn't selected. | True False |
Option group | [The OptionValue property setting] | The OptionValue property setting for the selected control in the group. |
Text box | [The value of the control's Text property] | The Text property returns the formatted string. The Text property may be different than the Value property for a text box control. The Text property is the current contents of the control. The Value property is the saved value of the text box control. The Text property is always current while the control has the focus. | |
Toggle button | True False | The toggle button is pressed in. The toggle button isn't pressed in. | True False |
Tab control | [An Integer value representing the index number of the currently selected Page object] | The Value property of a tab control contains the index number of the current Page object. There is one Page object for each tab in a tab control. The first Page object always has an index number of 0, the second has an index number of 1, and so on. | |
Bound object frame or chart control | The Value property for a bound object frame or a bound chart control is set to the value of the field that the control is bound to. Since these fields normally contain OLE objects or chart objects, which are stored as binary data, this value is usually meaningless. | ||
ActiveX control | Some ActiveX controls support the Value property. For example, the Value property setting for a Calendar control is the currently selected date in the control. For more information, see the documentation for each ActiveX control. |
Forms!frmCustomers!txtLastName = "Smith"
This means that the following two statements are equivalent.
Forms!frmCustomers!optCreditApproved.Value = True
Forms!frmCustomers!optCreditApproved = True
Note The Value property is not the same as the DefaultValue property, which specifies the value that a property is assigned when a new record is created.See Also DefaultValue property, OldValue property, OptionValue property, Text property.
Example The following example shows how you can call one of two procedures, depending whether the Credit check box on the Customers form is selected or cleared.Sub PaymentType()
If Forms!Customers!Credit.Value = False Then
ProcessCash
ElseIf Forms!Customers!Credit.Value = True Then
ProcessCredit
End If
End Sub