Container Object and Containers Collection Example

This example enumerates the Containers collection of the Northwind database and the Properties collection of each Container object in the collection.

Sub ContainerObjectX()

    Dim dbsNorthwind As Database
    Dim ctrLoop As Container
    Dim prpLoop As Property

    Set dbsNorthwind = OpenDatabase("Northwind.mdb")

    With dbsNorthwind

        ' Enumerate Containers collection.
        For Each ctrLoop In .Containers
            Debug.Print "Properties of " & ctrLoop.Name _
                & " container"

            ' Enumerate Properties collection of each
            ' Container object.
            For Each prpLoop In ctrLoop.Properties
                Debug.Print "  " & prpLoop.Name _
                    & " = " prpLoop
            Next prpLoop

        Next ctrLoop

        .Close
    End With

End Sub