DAO Object
 
Containers collection contains all of the Container objects that are defined in a database.
 

Remarks

Each Database object has a Containers collection consisting of built-in Container objects. Some of these Container objects are defined by the Microsoft Access database engine while others may be defined by other applications.
 
Returns the number of Container objects in the Containers collection.

Syntax

expression .Count
expression A variable that represents a Connections object.

Remarks

Because members of a collection begin with 0, you should always code loops starting with the 0 member and ending with the value of the Count property minus 1. If you want to loop through the members of a collection without checking the Count property, you can use a For Each...Next command.
The Count property setting is never Null. If its value is 0, there are no objects in the collection.
 
Note
ODBCDirect workspaces are not supported in Microsoft Access 2013. Use ADO if you want to access external data sources without using the Microsoft Access database engine. A Containers collection contains the current Containes objects of a Workspace object (ODBCDirect workspaces only).
 

Methods

Name
Description
Not supported for the Containers collection.
 

Properties

Name
Description
Returns the number of Container objects in the 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