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.