473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 3032
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,556 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, 953 views)
File Type: jpg BytesThread_968706_Selected.jpg (9.5 KB, 874 views)
May 13 '17 #6

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

Similar topics

3
by: pmud | last post by:
Hi, I have 4 columns in my sql database table. I added a data adapter , data set & a data grid to view this information. But the data grid is displaying those 4 columns TWICE , i.e in the data...
3
by: Antoine Janssen | last post by:
hi, I would like to create two combo boxes. In the first one you can select a user in the second one you can select a project. To simplify the selection i would like to shorten the project list...
2
by: =?Utf-8?B?RGFuaWVs?= | last post by:
Hi Guys i wanted to find out, what is the sql statement i need to count the number of rows in search query and also the statement i need for displaying columns that are not null I'm writing...
1
by: pankajswain | last post by:
i have taken a combo box and sets the property c omboBox1.DropDownStyle = ComboBoxStyle.Simple; at run time. autocomplete mode:SuggestAppend autocompletesource:List items i have taken some...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
3
by: Alo2aaa | last post by:
Dear all i have two linked combo boxes (master/child) ,the user wants to have multiple selection from both combo boxes , can u tell me how can i store them in a way that i can have a unique id...
4
by: banderson | last post by:
Hello amazing vba writers, I am trying to make a combo box return a value based on a combo box selection. I have tried a number of the codes posted here and am still having problems. I think it is...
0
by: Tony K | last post by:
I made a grid with several columns. 2 of the columns are foreign keys from 2 other tables in the datasource. I am unable to sort alphabetically by the combo box columns when I click on the column...
3
by: mbedford | last post by:
In my asset and employee database I have Departments and Subdepartments. In the forms I want to filter the Subdepartment combo boxes based on the selection in the Department combo box. Combo...
3
by: MOCaseA | last post by:
I have a record lookup form that has several combo box filters set up. However I noticed a slight problem. The filters are working correctly, but there are now over 2000 entries and when filtering...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.