Disabled Subform Logic Runs Anyway

  • Thread starter Thread starter Bill Sturdevant
  • Start date Start date
B

Bill Sturdevant

I have a main form with multiple subforms.

At various times, I disable some of the subforms.

Even though a subform is disabled, its Form_Open and
Form_Current routines run anyway!

I am startled by this. Am I doing something wrong?

I know I can check a flag and if it is set, then exit the
Form_Open and Form_Current, but it seems like they should
not run since the whole subform is disabled on the main
form.

Can anyone explain this?
 
What do you mean, Disabled?
I believe if you remove the name of the subform from the subform
control's data source then that subform will stop running. If you simply
hide it and leave its child/parent links intact, it will keep running in
the background.
Pavel
 
I have a main form with multiple subforms.

At various times, I disable some of the subforms.

Even though a subform is disabled, its Form_Open and
Form_Current routines run anyway!

I am startled by this. Am I doing something wrong?

I know I can check a flag and if it is set, then exit the
Form_Open and Form_Current, but it seems like they should
not run since the whole subform is disabled on the main
form.

Can anyone explain this?

The Subforms actually are opened BEFORE the mainform opens.

To thoroughly disable a Subform, set its SourceObject property to null
(removing the Form from the subform entirely).
 
Hi Bill

Enabled=False (No) simply means that the user cannot set focus to the
subform in that control. Note that it is not a property of the subform
itself, but only of the control that *contains* the subform.

If the subform knows the name of its container control, then you can check
its Enabled property and take appripriate action. For example:

If Me.Parent![Subform control].Enabled = False Then Exit Sub
 
Back
Top