Enable a textfield depending on the values in a combo box

  • Thread starter Thread starter Rex
  • Start date Start date
R

Rex

I have a main form and a subform. The main form has a combo box
control and the subform has a textfield.

What I want to do is when the main form loads it should check the
value of the combo box and if it, lets say "MZ" then the textfield in
the subform must be enabled otherwise it should be remain disabled.
This should be done without setting any explicit focus.

Any help would be greatly appreciated.
 
In the main form's load event:

Me.MySubFormControl.Form.MyTestBox.Enabled = Me.MyCombo = "MZ"

Of course, use the real names.
Note MySubFormControl is the name of the control on the mainform that
contains the form being used as a subform, NOT the name of the form object
being used as a sub form.
 
Rex said:
I have a main form and a subform. The main form has a combo box
control and the subform has a textfield.

What I want to do is when the main form loads it should check the
value of the combo box and if it, lets say "MZ" then the textfield in
the subform must be enabled otherwise it should be remain disabled.
This should be done without setting any explicit focus.

Any help would be greatly appreciated.

In the main form's OnLoad event procedure:

Me!SubformControlName.Form!TextField.Enabled = (Me.ComboBox = "MZ")
 
Back
Top