如何根据 MS Access 2007 中组合框中的值填充文本框的值? [英] How to populate the value of a Text Box based on the value in a Combo Box in MS Access 2007?

查看:16
本文介绍了如何根据 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)(根据内存,此 Column 是从零开始的).
就是这样,需要零代码.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆