Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Knowledgebase / FAQ _ Referring to embedded form (subform) controls (Illustrated)

Posted by: niesz Dec 21 2009, 09:22 PM

Many times we have a need to refer to a control on an embedded form (commonly called a subform). Referring to that control can be challenging if we aren't familiar with how embedded forms are addressed.

In the following example, our main form is named "FormA" and our embedded form is named "FormB". FormB contains a textbox control named "MyTextbox".

To refer to the value in MyTextbox, we need to know two things: [*] the name of the main form [*] the name of the subform control

Even though our embedded form is named FormB, that may or may not be the name of the subform control that contains it. The subform control may be named differently.

To make sure, switch to Design View and click the border of the subform object to select the subform control. The subform control is selected when you see eight "selection dots" as shown in the picture. Notice the Name property in the Properties dialogue when the subform control is selected. This subform control is named "MyInnerForm".

Notice the distinction between selecting the subform control and the embedded form itself:

** IMPORTANT TO NOTE: The name of the embedded form is not used when referring to a control on it. Only the name of the subform control that houses it.

So, our syntax for referring to a control on an embedded form is:


Therefore to refer to the contents of MyTextbox located on FormB, we use:


Note that if your object names contain spaces or special characters, you'll need to enclose them in square brackets like:

Forms.[Form A].[Inner Form].Form.[My Textbox]

...but the preferred method is to avoid all spaces and special characters altogether and then bracketing never becomes an issue.

For a more comprehensive list of how to refer to controls on other objects, please see this link:

I would like to thank the many members of the Utter Access community who assisted with the development of this FAQ.