Simple control subform from parent form

  • Thread starter Thread starter Zanetti via AccessMonster.com
  • Start date Start date
Z

Zanetti via AccessMonster.com

Hi, i have huge problem i dont know how can i control subform with vba code
from parent form. for diferent options i need to hide some fields in subform.
I try to do this from Vba but code dont recognized fields from subform.
 
If the name of the subform *control* on the main form is AAA, this will
hide the control of name BBB in the subform itself:

me![AAA].form![BBB].visible = false

Note:

(1) You do /not/ need the name of the actual subform itself.

(2) Remember that you can not hide a cotrol that currently has the
focus.

HTH,
TC
 
Hi, i have huge problem i dont know how can i control subform with vba code
from parent form. for diferent options i need to hide some fields in subform.
I try to do this from Vba but code dont recognized fields from subform.

The syntax for referencing a control on a subform is a bit peculiar.
You need to use the Name property *of the Subform control* - which
might or might not be the same as the name of the Form within that
control. E.g.

Me!subMySubform.Form!txtMyTextbox.Visible = False

will hide the textbox txtMyTextbox on whatever form is within the
subform control named subMySubform, provided that the code is running
in an event on the main form.

John W. Vinson[MVP]
 
John said:
The syntax for referencing a control on a subform is a bit peculiar.
You need to use the Name property *of the Subform control* - which
might or might not be the same as the name of the Form within that
control. E.g.

Me!subMySubform.Form!txtMyTextbox.Visible = False

will hide the textbox txtMyTextbox on whatever form is within the
subform control named subMySubform, provided that the code is running
in an event on the main form.

John W. Vinson[MVP]
Thanks John veeeeeeeeeeeeeeeeeery much
 
TC said:
If the name of the subform *control* on the main form is AAA, this will
hide the control of name BBB in the subform itself:

me![AAA].form![BBB].visible = false

Note:

(1) You do /not/ need the name of the actual subform itself.

(2) Remember that you can not hide a cotrol that currently has the
focus.

HTH,
TC


TNX verrrrrrrrrrrrrry much
 
Back
Top