I have a main form. And I have a text field named text123. when the user clicks the text123, it opens another form. In this new form there is two controls. one is a combo box named cmb1 and another is a textfield named text456. when the user selects an option from the combo box the lookup value is placed in the textfield on the form.
我有一个主表格。我有一个名为Text123的文本字段。当用户单击文本123时,它会打开另一个表单。在这个新表单中有两个控件。一个是名为cmb1的组合框,另一个是名为ext456的文本字段。当用户从组合框中选择一个选项时,查找值会放置在表单的文本字段中。
now I have an appen button on this form. How do I pass the value of the text456 in the second form to the text123 on the previous form when I click on the append buton.
现在,我在此表单上有了一个Appen按钮。当我单击Append Buton时,如何将第二个表单中的文本456的值传递给前一个表单上的文本123。
an example of the second form is shown below:
第二种形式的示例如下所示:
更多回答
Forms!MainForm.text123.Value = Me.text456.Value
?
Forms!MainForm.ext123.Value=Me.ext45.Value?
I will test it and see. Thank you.
我会测试一下,看看。谢谢。
优秀答案推荐
The easiest way to get the correct reference is to open both forms.
Then go select the form from which you want to update the other form.
Select a field and open in Properties Control Source and click on the ...
获取正确引用的最简单方法是同时打开两个表单。然后选择要从中更新其他表单的表单。选择一个字段并在属性控件源中打开,然后单击...
Then you will see the following Expression Builder window. In that window click on the + in front of Loaded Forms. Then you can select any control from any open form.
This gives you the exact syntax you need.
然后,您将看到下面的表达式生成器窗口。在该窗口中,单击加载的表单前面的+。然后,您可以从任何打开的表单中选择任何控件。这为您提供了所需的确切语法。
Just change
Forms!MainForm.text123.Value = Me.text456.Value
to
Forms!MainForm**!**text123.Value = Me.text456.Value
只需将Forms!MainForm.ext123.Value=Me.ext456.Value更改为Forms!MainForm**!**ext123.Value=Me.ext456.Value
更多回答
this answer feels low quality. It is technically correct but is mostly just a copy of a much older comment. Value is unnecessary. Meanwhile the other answer being a general method is of higher quality. finally and unfairly there is no mention of using public methods instead which gives much greater robustness and flexibility.
这个回答感觉质量不高。这在技术上是正确的,但主要是一个更老的评论的副本。价值是不必要的。另一个答案是一个通用的方法,质量更高。最后,不公平的是,没有提到使用公共方法,而这提供了更大的鲁棒性和灵活性。
我是一名优秀的程序员,十分优秀!