Help! Cascading combo box

aschachtel

Registered User.
Local time
Yesterday, 21:55
Joined
Jun 24, 2014
Messages
15
I am totally new to Visual Basic.

I have dependent cascading combo boxes setup. The hierarchy goes:
Segment
Family
Class
Brick
Now, I need the value in the Brick field to create a varying number of other cascading combo boxes. They are the Brick Attributes. The brick attributes are the labels for the combo boxes and the brick attribute values would be the values you can chose from within the combo boxes. Depending on which Brick you chose, there are a varying number of Brick Attributes, and thus a varying number of needed combo boxes to pop up.

Does anyone have an example form they could show me that they have done something like this on?
 
Huh? You asked for examples which I posted links to and now I see you have attached your database. Did you look at the examples?
 
I did. None of them solved what i was asking for. I know how to make dependent cascading combo boxes. But i need the result of one to create a varying number of other cascading combo boxes.
 
the Brick (core) attribute should be the combo box labels and the Brick (core) attribute values should be the options within those newly created combo boxes
 
Okay, well before we go any further you can't *create* a Combo Box based on any selection on an open Form. You can change the Row Source. Would that work for you?
 
My only concern is the appearance. For example, if I chose the Brick Code "Bread (Shelf Stable)" I need 7 combo boxes for the brick attributes and their values whereas for the Brick "Chicken - Prepared/Processed" I need 11 combo boxes for the brick attributes and their values.

Is this possible to do?
 
Then you can toggle them visible = yes/no which you do with a little VBA.
 
I know how to toggle them visible using VBA. But i need it to populate the correct number of fields and make them visible automatically for a very large set of Brick Codes and possible Brick Attributes and Attribute Values. It all needs to be automatic. I don't know if you quite understand what I'm looking for here.
 
The amount of controls to make visible or not doesn't matter and it will be automatic as long as there is a *trigger*.
 
can you give me an example of this trigger or what it would look like?
 
Something like a Select Case Statement...

Code:
Select Case YourFirstComboBoxThatControlsTheRest
 
Case 1 'This would be the PK of the First Combo Box
     Me.YourComboBox1.Visible = False
     Me.YourComboBox2.Visible = False
     Me.YourComboBox3.Visible = False
     Me.YourComboBox4.Visible = False
Case 2
     Me.YourComboBox1.Visible = False
     Me.YourComboBox2.Visible = False
     Me.YourComboBox3.Visible = True
     Me.YourComboBox4.Visible = True
Case Else
     'Do something here
End Select

So, the trigger becomes the selection made in the very Combo Box and you are using the PK to determine which Case statement applies hence which Combo Boxes are visible. AND, if some will never be visible at the same time you can also stack them thereby taking up less space on your Form.
 
Is there a way to write it so that i don't have to individually define which boxes are visible for each possible case (for each possible selection made in the trigger combo box). I have already defined the relationships in the database so i feel like there should be a way to do this. I just cant manually write a case for each selection because there are about 900 possible choices for the trigger and that opens up about 3,000 possible combo boxes as a result and it wouldnt make sense to write a case for each one of these. There must be a way to define the Brick Attributes as a variable and it will just use the predefined relationships to know which Brick Attributes to open as a result of the selected bricks.
 

Users who are viewing this thread

Back
Top Bottom