Enable a textfield depending on the values in a combo box

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.
 
K

Klatuu

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.
 
S

Stuart McCall

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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top