根据下拉列表的选择同步一个文本字段 [英] synchronizing one text field based on the selection of a drop down list

查看:84
本文介绍了根据下拉列表的选择同步一个文本字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在建立一个营养数据库来跟踪我的饮食习惯。我知道那里有很多,但我想自己做,你知道吗?


无论如何,我无法在任何地方找到答案。谷歌很棒,但我似乎无法找出用于找到答案的正确关键词。唉!


好​​的,我有一张桌子[food_by_calories]有两列,分别是[食物]和[卡路里]。


an例子就是这样的


[食物] .............. [卡路里]

汉堡.... ..350

香蕉............ 40


现在,我有一个查找下拉菜单到表,我可以从第一列中选​​择任何没有问题。我旁边还有一个文本字段,我想自动显示卡路里,这取决于我在下拉菜单中选择的卡路里。


有没有办法做到这一点?


Thx

Hello folks,

I''m building a nutrition database to keep track of my eating habit. I know there''s ton out there but I want to do it on my own you know?

Anyway there''s a tiny issue that I cant seem to find the answer anywhere. Google is great but I cant seem to figure out the right key word to use to find the answer. Argh!

Ok, I have a table [food_by_calories] that has two columns which are [food] and [calories].

an example would be like this

[Food]..............[Calories]
Hamburger......350
Banana............40

Now, I have a look-up drop down menu that goes to the table and I can select any from the first column with no problem. I also have a text field right next to it that I want to automatically display calories depending on which one I select in the drop down menu.

Is there a way to do this?

Thx

推荐答案

当然。没问题。


查看ComboBox控件的.Column()属性。


告诉我们你是怎么做的:)
Certainly. No problem.

Look at the .Column() property of the ComboBox control.

Let us know how you get on :)


@NeoPa


我查看了组合框属性表并了解了有关列的所有信息计数和绑定列。不知道在这种情况下它是如何帮助我的。


我试图弄清楚如何让文本字段自动选择第二列中的相应数据,具体取决于选择下拉字段。


示例:


我会在组合框中选择汉堡,然后文本字段会检查表格并查看汉堡包的卡路里是300,并将其插入文本字段。
@NeoPa
I looked at the combo Box property sheet and learned everything about column count and Bound Column. Dont see how it can help me in this situation.

I am trying to figure out how to get the text field to automatically select the corresponding data in the second column depending on the selection in the drop down field.

Example:

I would select Hamburger in the combo box and then the text field would check the table and see that the calories for hamburger is 300 and inserted it in the text field.


他们不能。这是我所指的 .Column()属性。它可以在VBA中访问,不仅可以控制返回哪一列,还可以控制当前所选行不是您需要的行。


正如我所说,我建议你阅读,因为我确信它完全满足你的需求。
They can''t. It was the .Column() property I was referring to. It is accessed in VBA and gives you control, not only over which column is returned, but also which row if the currently selected row is not what you need.

As I say, I suggest you read up on that as I''m sure it completely fulfills your needs.


这篇关于根据下拉列表的选择同步一个文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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