Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with Combo box and sub combo box on a form !!!!

Status
Not open for further replies.

mickeync

Programmer
Jan 26, 2003
28
US
Hi all,
I am working on the form that allow user to choose one of the selection from the 1st drop down box. When they pick one, the 2nd drop down box should appears to let them choose one from the 2nd box. For example, the 1st drop down box called DIVISION which have 4 selection "GENERAL BANKING" "GOVERNMENT BANKING" "BROKERAGE" "WEALTH MGT". The 2nd drop down box called SUBDIVISION for instance under General Banking will have Real Estate, Technology, HealthCare and so on .... (See below)

DIVISION ==> SUBDIVISION
1)General Banking ==> Real Estate, Technology, HealthCare..
2)Government Banking ==> Commercial, Business, ....
3)Brokerage (No subdivision)
4)Wealth Mgt (No subdivision)

How do I make this work if they pick Division "GENERAL BANKING" would allow them to choose the sub drop down box showing only "REAL ESTATE, TECHNOLOGY, HEALTHCARE, ..." Same thing when they choose option 2 "Government Banking", it should show only the choices of "COMMERCIAL, BUSINESS, ..." and if they choose DIVISION "BROKERAGE" or "WEALTH MGT" it will hide the SUBDIVISION since there's nothing to choose from.

Any feedback would greatly appreciated. Thanks a bunch !!!
 
Are the categories in a table? If so, this will be easy. Create two comboboxes. For the first, have it bound to the table Division. The second combobox is bound to Subdivision WHERE DivisionId = me.cboDivision.

Division and Subdivision can be two tables, or two queries from a single table. I tried it and it worked just fine.

David
 
Hi David,
I created two tables DIVISION with 4 option and SUBDIVISION. However on SUBDIVISION table, should I include ALL the SUBDIVISION item eventhought it belongs to GENERAL BANK, GOVERNMENT BANKING as well ???? I mean how would I distinct between itself such as : GENERAL BANKING with subdivision: Real Estate, Technology, HealthCare..

2)Government Banking with SUBDIVISION Commercial,Business,

Thanks again, :)
 
Hi, mickeync... First of all, I'm sorry for my english...

As David said, if you're working with two tables, it should be very easy. You have to do the following:

The first table (DIVISION), must have this structure:
IdDivision
Description

The second one, should look like this:
IdSubDivision
IdDivision
Description

I suggest the use of a DataCombo instead of a regular Combo, because the first one allows you to display the description and obtain the identity of that description. So, you can filter the subdivision list as follows:

SELECT * FROM SUBDIVISION WHERE IdDivision = Combo1.BoundText

Of course, it will work assuming you're developing in Visual Basic...

If you want, I can send you a sample code.

Regards,

Sergio Lugo
 
Don't forget to force your second combo box to requery after you select the division in the first combo box.

So the OnUpdate property for me.cboDiv will include code something like this:

me.cboSubDiv.Requery

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top