设置一个窗体控件,该控件在选择组合框中的值时进行更新 [英] Set up a form control that updates when a value in a combo box is selected
问题描述
我在设计的订单输入表单上有一个组合框,允许我从标题为tblCustomers的表的公司名称下拉列表中进行选择.该控件的行来源是:
I have a combo box on an Order Entry Form I designed that allows me to select from a dropdown of Company Names from a table entitled tblCustomers. The row source for this control is:
SELECT CustomerID, CompanyName FROM tblCustomers;
绑定列为1,这样我就可以将CustomerID存储在基础的tblOrders表中.
The bound column is 1 so that I can store the CustomerID in the underlying tblOrders table.
我的问题是:
我希望表单上的文本框显示与在组合框中选择的客户相关联的SalesPerson(也在tblCustomers表中).
I would like a text box on the form that displays the SalesPerson (which is also in the tblCustomers table) associated with the Customer chosen in the combo box.
推荐答案
您可以在组合中利用column属性:
You can take advantage of the column property in combos:
如果组合的行源是:
SELECT CustomerID, CompanyName, SalesPerson FROM tblCustomers;
您可以设置文本框的控件源以引用列属性(从零开始计数):
You can set the control source of a textbox to refer to column property, counting from zero:
=ComboX.Column(2)
您需要将列数设置为3.
You will need to set the column count to 3.
这篇关于设置一个窗体控件,该控件在选择组合框中的值时进行更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!