Visual Basic Reference

Value Property

See Also    Example    Applies To

  • CheckBox and OptionButton controls returns or sets the state of the control.

  • CommandButton control returns or sets a value indicating whether the button is chosen; not available at design time.

  • Field object returns or sets the content of a field; not available at design time.

  • HScrollBar and VScrollBar controls (horizontal and vertical scroll bars) returns or sets the current position of the scroll bar, whose return value is always between the values for the Max and Min properties, inclusive.

Syntax

object.Value [= value]

The Value property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value Value specifying the state, content, or position of a control, as described in Settings.

Settings

The settings for value are:

  • CheckBox control 0 is Unchecked (default), 1 is Checked, and 2 is Grayed (dimmed).

  • CommandButton control True indicates the button is chosen; False (default) indicates the button isn't chosen. Setting the Value property to True in code invokes the button's Click event.

  • Field object restricted only by the Field data types.

  • HScrollBar and VScrollBar controls set values between 32,768 and 32,767 to position the scroll box.

  • OptionButton control True indicates the button is selected; False (default) indicates the button isn't selected.

Remarks

A default property of an object is assumed, and doesn't need to be specified in code. For example, Field is the default property of any Recordset, and Value is the default property of a Field object. This makes the two statements below equivalent:

Dn.Fields("PubID").Value = X
Dn.("PubID") = X

The first statement specifies the default properties; the second statement assumes them.