Jim DeMarco
Jdemarco at hudsonhealthplan.org
Tue Oct 25 13:35:15 CDT 2005
I was thinking along the same lines because of the name/value association with properties. A collection doesn't really have a place to store the name except in the key which is not returnable by default (yes you can write your way around this shortcoming but it's not the natural nature of a collection). Storing objects in the collection would allow you store both. Jim DeMarco -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of DWUTKA at marlow.com Sent: Tuesday, October 25, 2005 2:23 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] When is a collection not a collection? 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com *********************************************************************************** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". ***********************************************************************************