vba 如何获取组合框中所选项目的值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24390155/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get a value of a selected item in combo box
提问by user3771820
I have a combo box called combo0 that has been populated with a query. It has three columns (ID, Int-name and sat name) column 1 is bounded. I want to store the id column so I can use it latter on. I have tried
我有一个名为 combo0 的组合框,其中填充了一个查询。它有三列(ID、Int-name 和 sat name),第 1 列是有界的。我想存储 id 列,以便以后可以使用它。我试过了
dim object Id as integer
object id = combo0.value
but it does not work.
但它不起作用。
采纳答案by evenprime
Possibly a Duplicate but
可能是重复但
Try,
尝试,
objectId=combo0.column(1)
回答by chris
If [ID] is the bound column then use Object ID = me.combo0.column(0). Simply using Object ID = me.combo0.value should also work. You may consider storing the value as a global variable.
如果 [ID] 是绑定列,则使用对象 ID = me.combo0.column(0)。简单地使用 Object ID = me.combo0.value 也应该有效。您可以考虑将该值存储为全局变量。