Value

<< Click to Display Table of Contents >>

 

Value

Variant Updated whenever a new value is read from the OPC server, according to OPC Block's ItemID property specifications where this OPC Block Element is inserted, and also considering the Index property, which specifies the position of an Element in an OPC Block array. This property's data type (integer, floating point, text, etc.) depends on the Driver to which it is associated and its configuration.

This property is only updated this way if the AllowRead property of the OPC Block to which the OPC Block Element belongs is set to True, and according to a scan time defined in the Scan property of the OPC Group that contains the OPC Block. If OPC Block's AllowWrite property is set to True, users can write values to the device simply by attributing a new value to the Value property.

This is also the default property of an OPC Block Element. Therefore, a reference by value to an OPC Block Element does not need necessarily to explicit its Value property to have access to its value. If this property is not being updated, check if the Index property is correctly configured (its value must be between zero and the size of the OPC Block minus one). Example:

Sub Button1_Click()
  ' Accesses an Element and shows its current value
  ' elm1 is an OPC Block Element object
  Set obj = Application.GetObject_
    ("OPCDriver1.Group1.OPCBlock1.elm1")
  MsgBox "Elm1's current value: " & obj.Value
  ' This can also be performed in a different way,
  ' without displaying the Value property, which is default
  MsgBox "Elm1's current value: " & obj
End Sub

Was this page useful?