Display two fields in a combo box

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,
 
G

Guest

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
 
J

J_Goddard via AccessMonster.com

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]
 
G

Guest

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
 

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

Similar Threads


Top