Remove Method

Microsoft Access Visual Basic

You can use the Remove method to remove an AccessObjectProperty object from the AccessObjectProperties collection of an AccessObject object.

expression.Remove(Item)

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

Item   Required Variant. An expression that specifies the position of a member of the collection referred to by the object argument. If a numeric expression, the index argument must be a number from 0 to the value of the collection's Count property minus 1. If a string expression, the index argument must be the name of a member of the collection.

ShowRemove method as it applies to the Pages collection object.

The Remove method removes a Page object from the Pages collection of a tab control.

expression.Remove(Item)

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

Item   Optional Variant. An integer that specifies the index of the Page object to be removed. The index of the Page object corresponds to the value of the PageIndex property for that Page object. If you omit this argument, the last Page object in the collection is removed.

Remarks

The Pages collection is indexed beginning with zero. The leftmost page in the tab control has an index of 0, the page immediately to the right of the leftmost page has an index of 1, and so on.

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

ShowRemove method as it applies to the References collection object.

The Remove method removes a Reference object from the References collection.

expression.Remove(Reference)

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

Reference   Required Reference object. The Reference object that represents the reference you wish to remove.

Remarks

To determine the name of the Reference object you wish to remove, check the Project/Library box in the Object Browser. The names of all references that are currently set appear there. These names correspond to the value of the Name property of a Reference object.

Example

ShowAs it applies to the Pages object.

The following example removes pages from a tab control:

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

    On Error GoTo Error_RemovePage
    Set frm = Forms!Form1
    Set tbc = frm!TabCtl0
    tbc.Pages.Remove
    RemovePage = True

Exit_RemovePage:
    Exit Function

Error_RemovePage:
    MsgBox Err & ": " & Err.Description
    RemovePage = False
    Resume Exit_RemovePage
End Function
				

ShowAs it applies to the References object.

The first of the following two functions adds a reference to the calendar control for the References collection. The second function removes the reference to the calendar control.

Function AddReference() As Boolean
    Dim ref As Reference, strFile As String

    On Error GoTo Error_AddReference
    strFile = "C:\Windows\System\Mscal.ocx"
    ' Create reference to calendar control.
    Set ref = References.AddFromFile(strFile)
    AddReference = True

Exit_AddReference:
    Exit Function

Error_AddReference:
    MsgBox Err & ": " & Err.Description
    AddReference = False
    Resume Exit_AddReference
End Function

Function RemoveReference() As Boolean
    Dim ref As Reference

    On Error GoTo Error_RemoveReference
    Set ref = References!MSCAL
    ' Remove calendar control reference.
    References.Remove ref
    RemoveReference = True

Exit_RemoveReference:
    Exit Function

Error_RemoveReference:
    MsgBox Err & ": " & Err.Description
    RemoveReference = False
    Resume Exit_RemoveReference
End Function