Class Documents (DAO VBA)

A Documents collection contains all of the Document objects for a specific type of object (Microsoft Access database engine databases only). To use a Documents class variable it first needs to be instantiated, for example


Dim docs as Documents
Set docs = Workspaces(1).Databases(1).Containers(1).Documents

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 docs As DAO.Documents: Set docs = 
docs.Count

Item

Item (Item)

Refresh

Updates the objects in the specified colletion to reflect the database's current schema.

Use the Refresh method in multiuser environments in which other users may change the database. You may also need to use it on any collections that are indirectly affected by changes to the database. For example, if you change a Users collection, you may need to refresh a Groups collection before using the Groups collection. A collection is filled with objects the first time it's referred to and won't automatically reflect subsequent changes other users make. If it's likely that another user has changed a collection, use the Refresh method on the collection immediately before carrying out any task in your application that assumes the presence or absence of a particular object in the collection. This will ensure that the collection is as up-to-date as possible. On the other hand, using Refresh can unnecessarily slow performance.


Dim docs As DAO.Documents: Set docs = 
docs.Refresh