"Ecohouse" <vindaloo1@netzero.comwrote in message
news:1166305679.790084.203080@l12g2000cwl.googlegr oups.com...
Quote:
Now I'm confused. What do you mean by "It needs to be the name of the
*control* that
hosts the first subform?" To me the name of the control is
"TrainingModuleTopicSK".
>
You're not saying to name this the following:
TrainingModuleTopicSK.Form!TrainingModuleTopicSK
>
The actual subform name is: subTrainingModule
The name of the control on that subform is: TrainingModuleTopicSK
It can be confusing to new users. The two rectangles you see on your main form
are *controls* just like TextBoxes or ComboBoxes or ListBoxes. They just happen
to be a special kind of control called a subform control. These subform
controls have a property "SourceObject" that determines what form is displayed
in them.
While it is convenient mental shorthand to think of a subform as "one form
inside another", in reality the outer, or parent form actually contains only a
subform control, not a copy of the actual form displayed inside the control.
Therefore when you want to reference a TextBox or field of a subform you have to
get there by going "through the subform control".
Access 97 and older display subform controls in design view as solid white
rectangles. This makes it pretty obvious that the object is a control and not
the actual form. The newer versions decided it would be better to display the
design of the form inside the subform control while in design view and this
obscures the fact that what you are looking at is NOT the actual form.
A good example of a similar control is an image control. In normal view you see
a picture on the form. In design view you don't see the image, but rather the
rectangular control that is used to display the image. A subform control is
just like that, a control that allows you to work with one form inside of
another, but it is a "window" so-to-speak to that other form.
The syntax I posted before is how you reference something on a subform. You
have to do it via the Form property of the subform control hosting the form. If
in design view of your main form you click one time on the edge of one of your
subforms that will select the subform control and you will see its properties
(including "Name") in the property sheet. If you click in the center of the
rectangle the property sheet will now show properties of the actual form inside
the control (more fuel for the confusion).
If you check the name property of the first subform control you might very well
find that it has the same name as the form within. That is fine, but it will
not always be the case. If the name is the same then the syntax you need is...
subTrainingModule.Form!TrainingModuleTopicSK
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com