Display two fields in a combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a table with 3 fields: ItemKey (number), Item (text), Detail (text)

On a form I would like to have a combo box that when clicking on the down
arrow the fields Item and Detail would show, which I can do. But, when a
choice is made I want both fields (item & detail) to show in the box.
Is this possible and if so how?

Thanks,
 
I could be wrong, but I don't think you can. I believe that a combo box will
only display one column (the first column with a width greater that zero) in
it's un-expanded state. You could put an unbound text box on your form right
next to the combo box, then use the AfterUpdate event to have the text box
display the value from the other column of your combo box

Or you could use a list box, but perhaps that won't work within the context
of your form design.

HTH
 
Use a query to combine (concatenate) the two fields item and detail, and then
base the combo box on the query instead of the table. The combo box will now
have two columns instead of three.

John

I could be wrong, but I don't think you can. I believe that a combo box will
only display one column (the first column with a width greater that zero) in
it's un-expanded state. You could put an unbound text box on your form right
next to the combo box, then use the AfterUpdate event to have the text box
display the value from the other column of your combo box

Or you could use a list box, but perhaps that won't work within the context
of your form design.

HTH
Hi,
I have a table with 3 fields: ItemKey (number), Item (text), Detail (text)
[quoted text clipped - 5 lines]
 
I use Sean (Beetle's) method. But I take it one step further. In the
GotFocus event of the combo box, I change the width of the combo to cover the
unbound textbox, and execute the combo's dropdown method to force the combo
to drop down, so you can see both of the columns.

Then, in the LostFocus of the combo, I populate the textbox with the value
that is contained in the 3rd field of the combo, and then shrink the width
back to its original width. I usually set the unbound textbox's Locked
property to True, or you could just disable it.

Dale
 
Back
Top