Check Box Control, Combo Box Control, List Box Control, Option Button Control, Option Group Control, Text Box Control, Toggle Button Control.
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.
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 |
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 (-1) False (0) |
Option group |
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 be current while the control has the focus. | |
Toggle button |
True |
The toggle button is selected (pressed in). |
True (-1) |
False |
The toggle button isn’t selected (not pressed in). |
False (0) |
You can set this property using only a macro or Visual Basic.
The Value property returns or sets a control’s default property, which is the property that is assumed when you don’t explicitly specify a property name. For example, because the default value of a text box is the value of the Text property, you can refer to its Text property setting without explicitly specifying the name of the property with the following code.
Forms!frmCustomers!txtLastName = "Smith"
This means that the following two statements are equivalent text.
Forms!frmCustomers!optCreditApproved.Value = True!Form1!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.
DefaultValue Property, OldValue Property, OptionValue Property, Text Property, Value Property (Microsoft Office 95 Data Access Reference).
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()Forms!Customers!Credit.Value = False ThenForms!Customers!Credit.Value = True ThenIfSub