Creating a Collection
The next stage is to create theCollectionobject to hold the individualMyPNameobjects.
Insert another class module using Insert | Class Module from the VBE menu bar. Change the
name toMyPNameson the property window and double-click the class module to enter it.
Change the Instancing property to PublicNotCreatable. This makes your object visible to
other applications.
The first thing to do is define a private variable to act as theCollectionobject in the same
way you defined a private variable to act as the property for theMyPNameobject. This needs
to be placed in the declarations section of the class module:
Private mPnames As Collection
This must have a unique name, so anmis placed in front of the collection name. The letterm
distinguishes the variable as a member variable.
268 Microsoft Access 2010 VBA Macro Programming
Figure 21-1 Using the Add Procedure dialog to enter a property