Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have quite a bit of experience in VB6 and use it to create applications for communicating with our products.
I have not used databases.
I have an application something like -

The application comes up to show 8 combo boxes each box has the full set of keyboard keys available to it, so for instance on the first drop down you can, (and do) select key a. On the next dropdown box you can now select b-z but not a (since it was used).
For 8 keys on the keyboard the user can select an action (i.e. turn on a light or make as sound).

What I need is the way to remove 'a' (or any other key) from the selectable set once it is selected.

I believe this is perfect for a database, so I wanted to create and internal table or recordset that would be tied to the comboboxes for just this purpose but I do not see any help on doing so.

Does anyone have any info on such a thing?

Thanks,
Martin
Posted

1 solution

The general concept you are asking about is known as "cascading combo boxes" - this is where the values available in subsequent combo boxes are based on previous selections...

Depending on exactly what you are wanting, you could have a simple select statement for your first combo box like this:

SQL
select FIELD from TABLE order by FIELD


Then for your next combo box, have something like:

SQL
select FIELD from TABLE where FIELD <> SELECTED_VALUE_IN_COMBO1 order by FIELD


This is the general way to achieve what you are after. Have a crack at it and post again with your code if you are getting stuck on a specific part.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900