Add Method (ActiveX/CAO)

Adds a new object to the specified collection.

Signatures: Overview

KeyDescriptions

VBA / VB.NET

RetVal = object.Add(Name, DataType [, Precision] [, Scale])
KeyValue

VBA / VB.NET

RetVal = object.Add(FieldName, Value)
LabelTemplates

VBA / VB.NET

RetVal = object.Add(DataSource, Catalog, Schema, Table, Name, DisplayAttributes)
LinkTemplates

VBA / VB.NET

RetVal = object.Add(DataSource, Catalog, Schema, Table, Name, KeyDescriptions)
Queries

VBA / VB.NET

RetVal = object.Add(DataSource, Catalog, Schema, Table, Name, SQLText)

Signature: KeyDescriptions.Add

VBA / VB.NET

RetVal = object.Add(Name, DataType [, Precision] [, Scale])
object

Type: KeyDescriptions

The object or objects this method applies to.

Name

Type: String; input-only

The name of the column to be added.

DataType

Type: CaoDataType enum; input-only

The data type of the column being added. Specify one of the following constants:

  • kCaoTypeText
  • kCaoTypeNumeric
  • kCaoTypeInteger
  • kCaoTypeDouble
  • kCaoTypeDate
  • kCaoTypeTime
  • kCaoTypeTimestamp
  • kCaoTypeBit
  • kCaoTypeBlob
Precision

Type: Integer; input-only; optional

The meaning of Precision depends on the DataType specified, as follows:

  • kCaoTypeNumeric: Precision of numeric data
  • kCaoTypeText: Length of data in symbols
  • kCaoTypeBlob: Length of data in bits

Precision is ignored for all other data types.

Scale

Type: Integer; input-only; optional

Numeric scale for kCaoTypeNumeric. Ignored for all other data types.

RetVal

Type: KeyDescription

The newly added object.

Signature: KeyValues.Add

VBA / VB.NET

RetVal = object.Add(FieldName, Value)
object

Type: KeyValues

The object or objects this method applies to.

FieldName

Type: String; input-only

The name of the field to be added.

Value

Type: Variant; input-only

The value of the field being added.

RetVal

Type: KeyValue

The newly added object.

Signature: LabelTemplates.Add

VBA / VB.NET

RetVal = object.Add(DataSource, Catalog, Schema, Table, Name, DisplayAttributes)
object

Type: LabelTemplates

The object or objects this method applies to.

DataSource

Type: String; input-only

Data source name.

Catalog

Type: String; input-only

Catalog name.

Schema

Type: String; input-only

Schema name.

Table

Type: String; input-only

Table name.

Name

Type: String; input-only

Label template name.

DisplayAttributes

Type: Variant (String or array of strings); input-only

Column names to be displayed as label or format strings. Where a single string is specified, CAO assumes the string is a format string. An array of strings is interpreted as a list of column names.

Format strings are compatible with MText format strings. Refer to database table columns in format strings using the following syntax:

#(<column name>)

For example:

#(name)

Column names are converted to the following format string:

#(<column name 1>\P#(<column name 2>)
RetVal

Type: LabelTemplate

The newly added object.

Signature: LinkTemplates.Add

VBA / VB.NET

RetVal = object.Add(DataSource, Catalog, Schema, Table, Name, KeyDescriptions)
object

Type: LabelTemplates

The object or objects this method applies to.

DataSource

Type: String; input-only

Data source name.

Catalog

Type: String; input-only

Catalog name.

Schema

Type: String; input-only

Schema name.

Table

Type: String; input-only

Table name.

Name

Type: String; input-only

Link template name.

KeyDescriptions

Type: KeyDescriptions; input-only

Key descriptions for the link template.

RetVal

Type: LinkTemplate

The newly added object.

Signature: Queries.Add

VBA / VB.NET

RetVal = object.Add(DataSource, Catalog, Schema, Table, Name, SQLText)
object

Type: Queries

The object or objects this method applies to.

DataSource

Type: String; input-only

Data source name.

Catalog

Type: String; input-only

Catalog name.

Schema

Type: String; input-only

Schema name.

Table

Type: String; input-only

Table name.

Name

Type: String; input-only

Link template name.

SQLText

Type: String; input-only

The SQL statement.

RetVal

Type: Query

The newly added object.