Naming controls on subform

  • Thread starter Thread starter Pele
  • Start date Start date
P

Pele

I tried to use a setvalue commannd with a macro and
refered to a textbox (TEXTYR) on a subform (3PIVOTTABLE
FORM_YTD_SUBFORM) but the macro I was using could not find
it. The macro was linked to a command button on the main
form (3PIVOTTABLE_YTD).


Below is the syntax I used.

[Forms]![ 3PivotTable Form_YTD]! [3PivotTable
Form_YTD_subform]! [textyr]

The macro was telling me that it couldn't find the main
form even though the command button linked to the macro is
on the main form.

By the way, is the caption on the form the name of the
form.

Pele
 
I tried to use a setvalue commannd with a macro and
refered to a textbox (TEXTYR) on a subform (3PIVOTTABLE
FORM_YTD_SUBFORM) but the macro I was using could not find
it. The macro was linked to a command button on the main
form (3PIVOTTABLE_YTD).


Below is the syntax I used.

[Forms]![ 3PivotTable Form_YTD]! [3PivotTable
Form_YTD_subform]! [textyr]

The macro was telling me that it couldn't find the main
form even though the command button linked to the macro is
on the main form.

By the way, is the caption on the form the name of the
form.

No. A Form has a Caption property and a Name property; they may be the
same or they may be different. In any case, the Name of the Form
you're using as a subform is irrelevant to referencing an object on
that form; what you need instead is the Name property of the *subform
control* on the main form. By default this is the same as the name of
the form within that control, but the names may be different.

If the name of the subform control is in fact

3PivotTable Form_YTD_subform

then the correct syntax would be

[Forms]![3PivotTable Form_YTD]![3PivotTable
Form_YTD_subform].Form![textyr]

all on one line. YOu appear to have some extra blanks in your
reference (before the form name and after the second !). The .Form!
reference is supposedly optional, but it's generally safest to include
it.

John W. Vinson[MVP]
 
Back
Top