Value Property (Field Object)

Value Property (Field Object)

The Value property returns or sets the value of the Field object. Read/write.



The Value property is the default property of a Field object, meaning that objField is syntactically equivalent to objField.Value in Microsoft® Visual Basic® code.

Data Type



The Value property of the Field object represents a value of the type specified by the Type property. For example, when the Field object has the Type property vbBoolean, the Value property can take the values True or False. When the Field object has the Type property vbInteger, the Value property can contain a short integer.

When you use a multivalued type, that is, a field including vbArray in its data type, you can access its individual elements, but you cannot subscript the field's Value property directly. You must copy the field's contents to a declared array variable for this purpose:

Dim colFields As Fields ' collection of fields on some object
' assume colFields and its parent are valid ...
Dim objField As Field ' single field, to be made multivalued string
Dim StringValues (100) As String ' to hold field's multiple values
' ...
arrStrings = Array("String1", "String2", "String3")
Set objField = colFields.Add("Strings", vbArray+vbString, arrStrings)
' ...
StringValues = objField.Value ' copy to array variable
MsgBox "Count: " & UBound(objField.Value) - LBound(objField.Value) + 1
For i = LBound(objField.Value) To UBound(objField.Value)
  MsgBox "Value: " & StringValues(i)
Next i
' alternate loop without subscripting:
'   For Each Value In objField.Value
'     MsgBox "Value: " & Value
'   Next


' fragment from function Field_Type()
' after validating the Field object objOneField
  MsgBox "Field type = " & objOneField.Type
' fragment from function Field_Value() ...
  MsgBox "Field value = " & objOneField.Value
'                 or just objOneField since .Value is default property

See Also


Field Object