Collections Are Objects Too

In a true object-centric environment, everything is an object. While Access, VBA, and DAO may not go this far, it is true that collections are objects and so they have their own properties and methods.

In the Access environment, collections can be divided into three types:

  • Microsoft Access collections, which are part of the Access object hierarchy

  • DAO collections, which are part of the DAO hierarchy

  • User-defined collections, which are VBA objects of type Collection

Note that only user-defined collections are of type Collection, which is a VBA data type, not a DAO data type. The properties and methods of collections are not very complicated, so let us list them here.

Properties and Methods of Access Collections

The Access collections Forms, Reports, and Controls have no methods and only one property: Count , which reports the number of objects in the collection. Thus, the line:

Forms.Count

reports the number of opened forms in the current database. (We will see later, when we discuss Container objects, that there is a way to get the number of saved forms as well.)

Properties and Methods of DAO Collections

DAO collections fall into two categories with respect to their properties and methods. All DAO collections have a single property: Count. All DAO collections also have the Refresh method, which we will discuss a bit later. In addition, some of the collections have the Append and corresponding Delete methods, while others do not.

Collections that ...

Get Access Database Design and Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.