Class Databases (DAO VBA)

A Databases collection contains all open Database objects opened or created in a Workspace object. To use a Databases class variable it first needs to be instantiated, for example


Dim dbs as Databases
Set dbs = Workspaces(1).Databases

Count

Returns the number of objects in the specified collection.

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.


Dim dbs As DAO.Databases: Set dbs = 
dbs.Count

Item

Item (Item)

Refresh

Not supported for this object.

You can't use the Refresh method with collections that aren't persistent, such as Connections, Databases, Recordsets, Workspaces, or the QueryDefs collection of a Connection object.


Dim dbs As DAO.Databases: Set dbs = 
dbs.Refresh