Share
 
 

CreateLabel Method (ActiveX/CAO)

Creates an attached or freestanding label.

Signature

VBA / VB.NET

RetVal = object.CreateLabel(Arg1, KeyValues, LabelTemplate [, DisplayValues])
object

Type: LinkTemplate

The object or objects this method applies to.

Arg1

Type: Long for object ID, or Variant (three-element array of Doubles); input-only

The graphical object to attach the label to, or the insertion point for a freestanding label.

KeyValues

Type: KeyValues; input-only

The key field values for the label.

LabelTemplate

Type: LabelTemplate, or String naming a label template; input-only

The label template for the label object.

DisplayValues

Type: Variant (array of Variants); input-only; optional

Values to be displayed in the label if no matching key field is found in the database table.

RetVal

Type: Label

The new label object.

Remarks

The values displayed in the created label depend on which arguments are passed to CreateLabel. Those values may be affected by a subsequent call to the Reload method. CreateLabel behaves as follows:

  • If a DisplayValues argument is supplied, the argument values are displayed in the label.
  • If DisplayValues is not specified, CAO attempts to retrieve a linked row from the database. If successful, values from the row are displayed in the label. If a linked row cannot be obtained (for example, no connection exists or key values have no match in the database), an error occurs.
  • If a DisplayValues argument is supplied, but you follow CreateLabel with a call to the Reload method, CAO attempts to retrieve a linked row from the database. If successful, database values are displayed in the label; if a linked row cannot be obtained, an error occurs.

Was this information helpful?