热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何隐藏ComboBox下拉列中的列?-HowtohidecolumnsinaComboBoxdropdown?

ImbuildingaComboBoxinanExceluserformthatgetsitsrowsfromanAccesstable.Iwanttodisp

I'm building a ComboBox in an Excel userform that gets its rows from an Access table. I want to display several text fields to the user in the dropdown, but the value returned from the ComboBox should be the ID number associated with the row that the user selects (i.e. the ID column is the bound column). But I don't want to show this ID number to the user. Is there a way to hide a column in the ComboBox's dropdown, but still have that column be bound?

我正在Excel用户窗体中构建一个ComboBox,从Access表中获取它的行。我想在下拉列表中向用户显示多个文本字段,但是从ComboBox返回的值应该是与用户选择的行相关联的ID号(即ID列是绑定列)。但我不想向用户显示此ID号。有没有办法在ComboBox的下拉列表中隐藏列,但是仍然要绑定该列?

1 个解决方案

#1


7  

If you have three columns - the first the ID that's hidden and the other two shown - do something like this in the Properties window:

如果您有三列 - 第一列是隐藏的ID而另外两列是 - 在“属性”窗口中执行以下操作:

enter image description here

Note that Combobox1.Text will get return the text in the 2nd column (the first visible one) and Combobox1.Value will give you the bound column. (The ColumnHeads setting has no bearing on the above).

请注意,Combobox1.Text将返回第二列(第一个可见的)中的文本,Combobox1.Value将为您提供绑定列。 (ColumnHeads设置与上述无关)。


推荐阅读
author-avatar
半路张三_711
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有