Create a control that references a control on another form
Note: The functionality explained in this article does not apply to "Access apps." For more information about working with Access apps, please see <insert link to placeholder topic>
.
This article describes you how to add a text box control to a form, and then set the properties for that text box so that it displays a value from a control on another form. This is useful in the following situations:
-
You have a main form that contains a subform; the subform contains a calculated text box (for example, a total of item prices), the results of which you want to display on the main form.
-
You have a form that contains a command button that opens a second form, and you want a text box on the second form to display the value of a control on the first form.
Create the control
-
In the Navigation Pane, right-click the form that you want to change, and then click Layout View.
-
On the Design tab, in the Controls gallery, click Text Box.
-
Click in the form where you want to create the text box.
-
Make sure that only the text box is selected. If necessary, click a different control, and then click the text box again.
-
If the property sheet is not already displayed, right-click the text box and then click Properties.
-
In the Property Sheet task pane, click the All tab.
-
Set the Control Source property using the following syntax:
=[ Forms]![ form name ]![ control name ]
Where form name is the name of the form that contains the control whose value you want to display, and control name is the name of the control.
Example
Suppose that you have a main form named Orders. This form contains a subform named Orders Subform, and the subform contains a calculated text box named OrderSubtotal. To display the value from the OrderSubtotal control on the Orders main form, you would add a text box to the Orders main form and specify its Control Source property as follows:
=[ Forms]![Orders Subform ]![ OrderSubtotal ]
No comments:
Post a Comment