【发布时间】:2021-09-13 16:27:23
【问题描述】:
有 3 个文本字段需要使用下拉组合中的列信息填充。
组合框控件名为 cmb_ao_owner(1),目标文本字段(用于传递列数据)分别为 txt_ao_owner_id(2)、txt_ao_owner_phone(3) 和 txt_ao_owner_email(4)。
文本字段将分别填充 column(1)、column(2) 和 column(3) 数据。来自组合框的查询是:
SELECT [dbo_SUP_CONTACTS].[sc_owner_id], [dbo_SUP_CONTACTS].[sc_owner],
[dbo_SUP_CONTACTS].[sc_work], [dbo_SUP_CONTACTS].[sc_email]
FROM dbo_SUP_CONTACTS ORDER BY [sc_owner];
控件在子子窗体中
parent-form: workbench
sub-form: contacts
sub-sub-form: asset_owners
..但我现在知道这并不重要,因为我认为“我”参数可以解决这个问题。
我面临的挑战是在更新事件之后将组合数据传递到同一行中的文本字段的语法。
图 A:尝试 1
Private Sub cmb_ao_owner_AfterUpdate()
me.parent.txt_ao_owner_id = [cmb_ao_owner].Column(2)
me.parent.txt_ao_owner_phone = [cmb_ao_owner].Column(3)
me.parent.txt_ao_owner_email = [cmb_ao_owner].Column(4)
End Sub
图 A:尝试 2
Private Sub cmb_ao_owner_AfterUpdate()
Me!txt_ao_owner_id = Me!cmb_ao_owner.Column(2)
Me!txt_ao_owner_phone = Me!cmb_ao_owner.Column(3)
Me!txt_ao_owner_email = Me!cmb_ao_owner.Column(4)
End Sub
每次尝试都会出错。有什么建议?非常感谢任何帮助。
谢谢。
【问题讨论】:
-
什么错误?列索引从 0 开始。所以第一列是索引 0,等等。为什么要将所有者信息复制到另一个表中?
标签: forms ms-access textbox ms-access-2010 subform