Add Method

Microsoft Access Visual Basic

You can use the Add method to add a new property as an AccessObjectProperty object to the AccessObjectProperties collection of an AccessObject object.

expression.Add(PropertyName, Value)

expression    Required. An expression that returns an AccessObjectProperties collection object.

PropertyName   Required String. A string expression that's the name of the new property.

Value   Required Variant. A Variant value corresponding to the option setting. The setting of the value argument depends on the possible settings for a particular option. Can be a constant or a string value.

Remarks

You can use the Remove method of the AccessObjectProperties collection to delete an existing property.

ShowAdd method as it applies to the FormatConditions collection object.

You can use the Add method to add a conditional format as a FormatCondition object to the FormatConditions collection of a combo box or text box control.

expression.Add(Type, Operator, Expression1, Expression2)

expression    Required. An expression that returns a FormatConditions collection object.

Type   Required AcFormatConditionType. The type of format condition to be added.

AcFormatConditionType can be one of these AcFormatConditionType constants.
acExpression
acFieldHasFocus
acFieldValue

Operator   Optional AcFormatConditionOperator. If the Type argument is acExpression, the Operator argument is ignored. If you leave this argument blank, the default constant (acBetween) is assumed.

AcFormatConditionOperator can be one of these AcFormatConditionOperator constants.
acBetween default
acEqual
acGreaterThan
acGreaterThanOrEqual
acLessThan
acLessThanOrEqual
acNotBetween
acNotEqual

Expression1   Optional Variant. A Variant value or expression associated with the first part of the conditional format. Can be a constant or a string value.

Expression2   Optional Variant. A Variant value or expression associated with the second part of the conditional format when the Operator argument is acBetween or acNotBetween (otherwise, this argument is ignored). Can be a constant or a string value.

Remarks

You can use the Delete method of the FormatConditions collection to delete an existing FormatConditions collection from a combo box or text box control.

ShowAdd method as it applies to the Pages collection object.

The Add method adds a new Page object to the Pages collection of a tab control.

expression.Add(Before)

expression    Required. An expression that returns a Pages collection object.

Before   Optional Variant. An Integer that specifies the index of the Page object before which the new Page object should be added. The index of the Page object corresponds to the value of the PageIndex property for that Page object. If you omit this argument, the new Page object is added to the end of the collection.

Remarks

The first Page object in the Pages collection corresponds to the leftmost page in the tab control and has an index of 0. The second Page object is immediately to the right of the first page and has an index of 1, and so on for all the Page objects in the tab control.

If you specify 0 for the Before argument, the new Page object is added before the first Page object in the Pages collection. The new Page object then becomes the first Page object in the collection, with an index of 0.

You can add a Page object to the Pages collection of a tab control only when the form is in Design view.

ShowAdd method as it applies to the AdditionalData object.

Adds an add table or query that will be included whent he ExportXML method is called Returns AdditionalData.

expression.Add(var)

expression    Required. An expression that returns an AdditionalData object.

var    Required String. The name of the table or query to add.

ShowAdd method as it applies to the SmartTagProperties object.

Adds a custom property to a smart tag. Returns SmartTagProperty.

expression.Add(Name, Value)

expression    Required. An expression that returns a SmartTagProperties object.

Name    Required String. The name to be used for the custom property.

Value    Required Variant. The value of the custom property.

ShowAdd method as it applies to the SmartTags object.

Adds a smart tag to a form, control, or data access page. Returns SmartTag.

expression.Add(Name)

expression    Required. An expression that returns one a SmartTags collection.

Name    Required String. The name of the smart tag to add.

Example

ShowAs it applies to the Pages collection object.

The following example adds a page to a tab control on a form that's in Design view. To try this example, create a new form named Form1 with a tab control named TabCtl0. Paste the following code into a standard module and run it:

Function AddPage() As Boolean
    Dim frm As Form
    Dim tbc As TabControl, pge As Page

    On Error GoTo Error_AddPage
    Set frm = Forms!Form1
    Set tbc = frm!TabCtl0
    tbc.Pages.Add
    AddPage = True

Exit_AddPage:
    Exit Function

Error_AddPage:
    MsgBox Err & ": " & Err.Description
    AddPage = False
    Resume Exit_AddPage
End Function