Share via


Add Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

Add method as it applies to the AccessObjectProperties collection object.

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.

Add 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.

AcFormatConditionType

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

AcFormatConditionOperator

AcFormatConditionOperator can be one of these AcFormatConditionOperator constants.
acBetweendefault
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.

Add 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.

Example

As 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