我一直在环顾四周,似乎找不到准确的答案,至少引导我朝着正确的方向前进。在form1(成员)上,我有一个按钮,用一个组合打开另一个表单(主管)。组合有3个字段,在选择时,我希望它将3个值存储在form1上的文本框中,然后关闭表单2(我知道这个代码)。
在关闭表单之前,请使用如下的Vba代码
Forms![MEMBER].Textbox1= Me.Combobox1 ' set the value of combobox to your Textbox in Form1
Docmd.close 'Close the form
要在form1上设置值,请使用带有索引值的Column
的Combobox
属性,
Forms!form1!Textbox1 = Me.Combobox1.Column(0) & " " & Me.Combobox1.Column(1) & " " & Me.Combobox1.Column(2)
没关系,一旦我的大脑开始工作,我就能弄清楚...
Dim supervisor1 As Variant
Dim supervisor2 As Variant
Dim supervisor3 As Variant
Dim supervisor4 As Variant
supervisor1 = Me.Combo0.Column(0)
supervisor2 = Me.Combo0.Column(1)
supervisor3 = Me.Combo0.Column(2)
supervisor4 = supervisor1 & " " & supervisor3 & " " & supervisor2
Forms![Member].Text48 = supervisor4