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
objects.
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?
Drew
-----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
Or
set lcol = MyTDF.Properties
You will get a run time error: "Type Mismatch"
Sigh.
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.
Sigh.
The properties collection has different properties and methods:
Append
Count
Delete
Refresh
John W. Colby
www.ColbyConsulting.com
Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com