Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide columns in a ComboBox dropdown?

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?

like image 564
sigil Avatar asked Feb 04 '12 04:02

sigil


1 Answers

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:

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

like image 77
Doug Glancy Avatar answered Sep 22 '22 01:09

Doug Glancy