[AccessD] DependentObjects class

John W. Colby jwcolby at colbyconsulting.com
Thu Mar 11 12:59:40 CST 2004


Its not quite that simple.  Many different objects can use data from the
same table including other forms / subforms, lists, combos etc.  Further the
table may be part of a complex query in that object over there where it is
the whole query in this object etc.  In my mind it is better to just let the
developer tell the system "this object is dependent on that object" and / or
"this object uses the same data as that object".

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Bryan
Carbonnell
Sent: Thursday, March 11, 2004 1:16 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] DependentObjects class


> In this specific case, ComboA is NOT dependent on ComboB and ComboB is
NOT
> dependent on ComboA they are just displaying the same potential
dataset.  If
> ComboA causes the dataset to change then ComboB needs to be requeried
so
> that it can pick up the changes.  ComboB does NOT need to requery any
other
> objects however since it did not initiate the changing data. It turns
out
> that I am using the same functionality for different purposes and
that is
> really what causes the problem.

In that case, in your custom NotInList event when the data is added why
not do something like this:

'Assumptions - Parent of combo class is a form class
' and the combo class has a parent property that
' points to the form class

' All of this is pseudo code

'Loop through all the combo classes in the parent
For each ComboClass in Me.Parent.ComboClasses
  'Check to see if the RowSource of the ComboClass is the
  ' same as this class' row source
  If ComboClass.RowSource = Me.RowSource then
    'It is, so requery the combo class
    ComboClass.Requery
  End If
Loop

I would think that if you did it this way, then both possibilities (A
dependant on B and A and B share a Row Source) will be covered in the
same class and you don't have to create a separate collection to hold
the row sources.

Just an idea.

>Thanks for pointing out the obvious.

Glad to Help?!?! I think. :)

Bryan Carbonnell
bryan_carbonnell at cbc.ca





More information about the AccessD mailing list