[AccessD] DependentObjects class

DWUTKA at marlow.com DWUTKA at marlow.com
Mon Mar 15 13:38:34 CST 2004


Sounds like a case of withevents.

I built an inventory system for a customer, which held a few 'global'
classes.  One such class was the Inventory itself.  When the application
started, it created a global Inventory class.  Then, whenever I had a form
that utilized the Inventory, instead of using separate code, I set a
'withevents' reference to the global Inventory class.

That way, I not only could use the Inventory Classes prebuilt code to
display inventory, but I could also sink the 'InventoryUpdated' event, in
every form that used Inventory.  By using the global Inventory class to
update inventory, I would simply raise the 'InventoryUpdated' event, to
alert any and all open forms that inventory has been changed.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of John W. Colby
Sent: Wednesday, March 10, 2004 11:11 PM
To: AccessD
Subject: [AccessD] DependentObjects class


I am working on a dependentobjects class, i.e. a class with a collection
which holds objects (classes) where the control or form is dependent on the
current control.  Combo A changes.  Combo B uses Combo A to filter itself.
Combo B is "dependent" on combo A and must be requeried whenever Combo A
changes.

There is a case where two combos on a form may display data from the same
table.  For example two combos both display cities from the cities lookup
table.  If Combo A NotInList adds a new city. Combo B needs to requery in
order to display that new city if necessary.  However if Combo B adds the
city, then Combo A needs to requery.

Obviously if we add combo A to combo B's DependentObject collection and we
add Combo B to Combo A's dependent object collection, then we start an
endless loop where A requeries B which requeries A which requeries B...

This is a case where I programmed a solution working but it was ugly.  How
would you solve this problem?

John W. Colby
www.ColbyConsulting.com


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list