Solved

multi column ComboBox

Posted on 2000-03-14
8
341 Views
Last Modified: 2012-05-04
Is there an easy way to create a multi columns datacombobox or to link the item selected with an other field

eg:

these values are in a table

id   label
-----------
1  |  man
2  |  Woman
3  |  Martian

the value 1,2,3 are listed in the dropdown combo, when I select 2, woman is printed in a textbox; I'd like to do this without having so create a query (it would be too easy :-))

thanks...
0
Comment
Question by:Pleinpopossum
8 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2616156
The easiest way is to concatenate the 2 fields in your Select query (Select Id + ' - ' + Label AS FieldToDisplay From Table1) and bind the new field to the DataCombo.
0
 

Author Comment

by:Pleinpopossum
ID: 2616193
Thank you very much emoreau. The idea is not so bad but the label is just to make the user to ensure he chose the right code. I already thought to this solution. So... I can't use it this way because I would need to isolate the code from the label for other ops... So I'd prefer a solution which would modify the value in the textbox when I change the value in the combo.

Xav.
0
 
LVL 4

Expert Comment

by:vindevogel
ID: 2616237
Standard functionality of the Sheridan grid / combobox (www.shersoft.com)
(Datawidgets)

You have 3 ways of adding data there.
Bound, Unbound or ADDITEM
In the additem, you can add whatever you want, multicolumn, ... It's reacting afterwards just like it came from a query.

Check the properties BoundText, BoundColumn and ListField ....
0
 

Expert Comment

by:pinshah
ID: 2616269
Bound both the combo and the Text box with same recordset.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Accepted Solution

by:
ndb earned 100 total points
ID: 2616367
You can also do this with the Microsoft Forms 2.0 controls.
You can bound these controls too.
I use it because I also have a text that is shown to the user in the combobox and an index that doesn't appear to the user.
0
 
LVL 2

Expert Comment

by:damienm
ID: 2616373
If you have 2 combo boxes, I visible and 1 invisible, the second containing label, then when you select item 1 from combo1 set the textbox = the corresponding item in the list from combo2
0
 

Expert Comment

by:ckhlam
ID: 2618294
Try to use combo box to keep the id and array to keep the labels.  Whenever you click a item on combo box,

txtLabel = aryLabel(cboID.listindex)

Then the label value can be printed on the text box.
0
 

Author Comment

by:Pleinpopossum
ID: 2618784
The idea is good but I'm looking for a "natural" solution. In fact the main problem is that the combo has to be linked with a database. It means I'd better to use a datacombo. Thanks to ndb I discovered the Krosoft forms controls 2. It doesn't exactly reply to my problem but it helped me for other problem.

Thanks a lot for trying to help me.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now