如何在ComboBox下拉列表中隐藏列? [英] How to hide columns in a ComboBox dropdown?

查看:261
本文介绍了如何在ComboBox下拉列表中隐藏列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

如果你有三个列 - 第一个隐藏的ID,另外两个显示 - 在属性窗口中执行此操作:

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:

请注意,Combobox1.Text将返回第2列中的文本(第一个可见一个)和Combobox1.Value将给你绑定列。 (ColumnHeads设置与上述无关)。

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).

这篇关于如何在ComboBox下拉列表中隐藏列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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