[AccessD] When is a collection not a collection?

DWUTKA at marlow.com DWUTKA at marlow.com
Tue Oct 25 13:23:17 CDT 2005

A couple of thoughts on this JC.  First, a property really isn't an object.

Let's say you had this for a class:

Public SomeValue As Long
Property Get MyTextValue() As String
MyTextValue = "Something"
End Property

Now, if I were to do this:

Dim MC As MyClass
Dim lCol As Collection
Set lCol = New Collection
Set MC = New MyClass
lCol.Add MC.MyTextValue
Set lCol = Nothing
Set MC = Nothing

I'm not really adding the MyTextValue 'Property' to the lCol collection.
I'm just adding the value of that property.  The property isn't an object,
it's only a property of an existing object, not really 'child objects' in a
collection.  The collection you can use 'Properties' is just a
representation of those properties, not really a collection of child

I wrote a project a while back, which is an add-on for VB, that would create
a 'Properties' 'collection' for a Class.  Because when you have a custom
class, you can't say 'MyClass.Properties("SomeProperty")=1', at least not
without actually coding a 'Properties' class.  So I wrote a project that did
just that, it built a Properties class for you.

So I wonder if the Properties collection in the DAO objects is similar to
that, not a real collection, but simply a 'coded' method of being able to
'refer'/'cycle through' or soft code the properties of the object?


-----Original Message-----
From: John Colby [mailto:jwcolby at colbyconsulting.com]
Sent: Tuesday, October 25, 2005 12:41 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] When is a collection not a collection?

When it is a properties collection?

Try dimming a collection

Dim lcol as collection

Then try setting that collection to any DAO object's properties collection:

	set lcol = MyFld.Properties

	set lcol = MyTDF.Properties

You will get a run time error: "Type Mismatch"


AFAICT, all of the other object collections in the database container - the
tabledefs, fields, forms etc are all true collections, i.e. you can dim a
collection and save a pointer to these object collections in your
collection.  Not so with the Properties collection of any object.


The properties collection has different properties and methods:


John W. Colby

Contribute your unused CPU cycles to a good cause:

AccessD mailing list
AccessD at databaseadvisors.com
Website: http://www.databaseadvisors.com

More information about the AccessD mailing list