471,893 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,893 software developers and data experts.

Combo Box displaying 2 columns after selection

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:


5 2682
PhilOfWalton
1,430 Expert 1GB
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
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
32,470 Expert Mod 16PB
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
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
5,501 Expert Mod 4TB
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, 845 views)
File Type: jpg BytesThread_968706_Selected.jpg (9.5 KB, 788 views)
May 13 '17 #6

Post your reply

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

Similar topics

3 posts views Thread by pmud | last post: by
3 posts views Thread by Antoine Janssen | last post: by
2 posts views Thread by =?Utf-8?B?RGFuaWVs?= | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.