Control subform loading order?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Access project that consists of a form and several subfoms. Is
there a way to control the order in which the subforms load?

If so, how is this done? Where is the best place to do this so the subforms
will load in the proper order on application launch?

Thanks in advance.
 
facklis said:
I have an Access project that consists of a form and several subfoms.
Is there a way to control the order in which the subforms load?

If so, how is this done? Where is the best place to do this so the
subforms will load in the proper order on application launch?

Thanks in advance.

If you're talking about true subforms, displayed in subform controls on
the main form, I don't think you can reliably control the order in which
they load except by leaving the SourceObject properties of all the
subform controls blank, and then setting them at run time to the names
of the appropriate form objects, in the order you want.

Why would you want to do this?
 
I have a button on one of the subforms which I would like to enable if
certain fields are populated on another subform. Currently, checking the
value of one of the fields fails, since the subform is not yet loaded.

This is true even though it would appear that the subforms should load in a
particular order based on their logical relationship.

To be more specific:

Contracts (form)
-License (subform)
-Maintenance (subform)
-Order (subform)

Each form/subform corresponds to a different SQL Server table. I need to
check whether fields on the License subform are populated to enable a button
on the Order subform.

I'm doing the checking in the Form_Current event in the subforms.

Thanks in advance.
 
facklis said:
I have a button on one of the subforms which I would like to enable if
certain fields are populated on another subform. Currently, checking
the value of one of the fields fails, since the subform is not yet
loaded.

This is true even though it would appear that the subforms should
load in a particular order based on their logical relationship.

To be more specific:

Contracts (form)
-License (subform)
-Maintenance (subform)
-Order (subform)

Each form/subform corresponds to a different SQL Server table. I need
to check whether fields on the License subform are populated to
enable a button on the Order subform.

I'm doing the checking in the Form_Current event in the subforms.

The word "populated" is pretty vague. Bear in mind also that the
Current event of a subform may fire multiple times as the subform is
first loading.

It seems to me from your description that this may be a data problem,
best solved by checking directly in the underlying table to see if the
the required conditions are met. Did you say this was an ADP? I
haven't worked with ADPs much, so I'm not sure offhand whether you can
use the DLookup function to find out what you need to know, or whether
you have to create and open your own ADO recordset to query the table.
Does that sound like a plausible approach to you? It would free you
from any dependency on the order in which the subforms are loaded.
 
Back
Top