The Properties Collection

One item that has been left out of the diagram of the DAO object model which is shown earlier in Figure 14.5 (and is done so in most DAO diagrams) is the Properties collection. This is because every DAO object has a Properties collection, so it would clutter up the diagram considerably, without adding much information. Figure 14.9 shows a Properties collection.

An Access properties collection diagram

Figure 14-9. An Access properties collection diagram

The purpose of the Properties collections is simple. Properties are objects too and so they are contained in collections, just like all other objects of the DAO (except DBEngine). Thus, the Properties collection of an object contains the Property objects (better known simply as properties) for the object.

The fact that the properties of an object are themselves objects, and thus reside in a collection, implies that we may access these properties in several different ways. For example, the RecordCount property of the TableDef object BOOKS can be referred to in any of the following ways (among others):

TableDefs!BOOKS.Properties!RecordCount
TableDefs("BOOKS").Properties("RecordCount")

or just:

TableDefs!BOOKS.RecordCount

Of course, the latter form is the simplest and most commonly used. Note that the Properties collection is never the default collection for any object. Hence, for example, the syntax:

TableDefs!BOOKS!RecordCount

(which differs from the ...

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.