By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,660 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,660 IT Pros & Developers. It's quick & easy.

Combo Box displaying 2 columns after selection

P: 7
I have a combo box that lists the class code and the class code description in the drop down. Once you make your selection it only shows the class code and I would like it to show both the class code and the class code description. I know it is something very simple, but I can get it to work correctly. Here is my code:
Expand|Select|Wrap|Line Numbers
  1. SELECT [Class Codes].[Description ID], [Class Codes].[Class Code], [Class Codes].Description
  2. FROM [Class Codes]
  3. ORDER BY [Class Codes].[Class Code], [Class Codes].Description;
May 3 '17 #1

✓ answered by zmbd

Do you mean something like this?
I have the first name in one field
the second name in another field
and the email in yet a third field

So I can select the person and all three field's information is shown in the form's combobox...
while selecting data:



After selection in the CBOX is made:


Share this Question
Share on Google+
5 Replies


PhilOfWalton
Expert 100+
P: 1,430
It can't be done with a Combo Box.

Options are
1) Use a list box
2) This is a bit tricky, but you have 2 text boxes, the Control source of the first one is
=MyCombo.Column(0) and the second text box is =MyCombo.Column(1)
Where MyCombo is the name of your Combo Box

Now the trick is to make the width of the first text box the same as the width of the combo box less the little grey dropdown bit on the right of the combo box. Lay this text box exactly over the Combo Box so that just the grey bit shows. Use the arrange to bring the text box to the front. Set the text box to locked.

Here is a picture where I haven't overlapped them completely.

Note that the fonts must all be the same.



Phil
May 3 '17 #2

P: 7
Phil - Thank you for the information. Is there anyway that it can be done in the coding instead of this way?
May 3 '17 #3

NeoPa
Expert Mod 15k+
P: 31,487
Hi Denielle.

When closed a ComboBox will show a single value. However, cloumns in a ComboBox can have individual values that are made up of multiple textual values.

For instance, "XXX - Description for XXX"; "YYY - Description for YYY"; etc.

These can be used in conjunctions with, or even instead of, the individual values themselves. Let us know if this is enough for you to get going or whether further explanation is necessary.

Best of luck :-)
May 3 '17 #4

P: 7
Thank you to both of you for your assistance. I figured out a different solution, it still does not show both columns, but it shows that information that I need. Thanks again
May 5 '17 #5

zmbd
Expert Mod 5K+
P: 5,397
Do you mean something like this?
I have the first name in one field
the second name in another field
and the email in yet a third field

So I can select the person and all three field's information is shown in the form's combobox...
while selecting data:



After selection in the CBOX is made:

Attached Images
File Type: jpg BytesThread_968706.jpg (42.4 KB, 183 views)
File Type: jpg BytesThread_968706_Selected.jpg (9.5 KB, 253 views)
May 13 '17 #6

Post your reply

Sign in to post your reply or Sign up for a free account.