Combo Box Question

B

Bob V

I have a Combo Box that has 7 Columns
0cm;1cm;2cm;0cm;5cm;1.5cm;3cm;
When I select my row it shows the 1cm Column, can it be change to show the
2cm; column (Column2) with changing the order of what they are showing???
Thanks for any Help,..................Bob
 
B

Bob V

Thanks Arvin, But i wanted the 2nd Column displayed to show after
selecting....Thanks Bob
 
R

Rick Brandt

Bob said:
Thanks Arvin, But i wanted the 2nd Column displayed to show after
selecting....Thanks Bob

You can't do that. You can put the same content into a new column2 (shifting
all other columns over one position) and make the new column very narrow, but
not zero width. To the user it will look about like it does now, but the skinny
column is what will be displayed after making a selection.

Caveat: This breaks the AutoExpand feature because the user's keystrokes will
now be matched against the skinny column rather than the first "visible" column
as they might expect.
 
K

Ken Sheridan

Bob:

Another way in which you can sort of achieve what you want by using a hybrid
control made up of your combo box and a text box overlaid on top of it so it
exactly covers the text box part of the combo box, leaving only the down
arrow visible to the right. To the user it will look like a single combo box
control. This is really the same as Arvin's suggestion, but with the text
box superimposed on the combo box rather than separate from it. You'll also
need to do the following:

1. Set the TabStop property of the combo box to False ('No' in its
properties sheet).

2. Set the ControlSource property of the text box to an expression
referencing the third column of your combo box, e.g.

=YourComboBox.Column(2)

(the Column property is zero-based, so Column(2) is the third column)

3. In the AfterUpdate event procedure of the combo box move focus to the
text box, e.g.

Me.YourTextBox.SetFocus

This will work after a fashion but is pretty kludgy. The user can drop down
the combo box with the arrow and select a row, but they can't type a value
into the control and go to the first match using the autoexpand feature; or
more strictly speaking they can only do so after dropping down the list, and
even then they'd have to type a value for the second column (i.e. the first
visible column) not the third. So all in all the this solution is akin to Dr
Samuel Johnson's description of a dog walking on its hind legs in that the
wonder is not that it is done well, but that it done at all. Why not simply
reverse the order of the second and third columns in the combo box's
RowSource? That way you can use the combo box in the normal way and see the
relevant column in the control after a selection is made.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top