Set up a form control that updates when a value in a combo box is selected

别说谁变了你拦得住时间么 提交于 2019-12-24 08:29:21

问题


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; 

The bound column is 1 so that I can store the CustomerID in the underlying tblOrders table.

My question is:

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.


回答1:


You can take advantage of the column property in combos:

If the row source of your combo is:

 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)

You will need to set the column count to 3.



来源:https://stackoverflow.com/questions/14944042/set-up-a-form-control-that-updates-when-a-value-in-a-combo-box-is-selected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!