如何根据MS Access 2007中的组合框中的值填充文本框的值? [英] How to populate the value of a Text Box based on the value in a Combo Box in MS Access 2007?
问题描述
我有一个查找类型的组合框,即我已经选择源为一个表中的列,并将选定的值存储在另一个表中。我查找的表有另一列,我需要该列中的值显示在文本框中,每次我更改组合框中的值,我需要相应的值显示在文本框中。我如何做到这一点?我到目前为止做的是写一个 Select
查询,根据组合框的值选择合适的列。有没有更好的方式这样做?请帮助我!
I have a combo box which is of a lookup type, i.e., I've selected the source to be a column from a table and am storing the selected value in another table. The table which I am looking up has another column and I need the value in this column to be displayed in a text box and each time I change the value in the combo box, I need the corresponding value to be displayed in the text box. How can I do this? What I have done so far is to write a Select
query that selects the appropriate column based on the combo box's value. Is there a more decent way of doing this? Please help me!
推荐答案
将组合框的源代码添加到您的2个字段中。 SELECT id,name FROM Customers
因此,请确保将组合的列计数属性设置为2。
使得未绑定的文本框源等于 = MyCombo.Column(1)
(从内存中,此列为零)。
就是这样,零需要代码。
Make the source of the combo box to your 2 fields e.g. SELECT id, name FROM Customers
Make sure you set the Column Count property of the combo to 2, accordingly.
Then make you unbound text box source equal to =MyCombo.Column(1)
(from memory, this Column is zero based).
That's it, zero code required.
这篇关于如何根据MS Access 2007中的组合框中的值填充文本框的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!