VBA Mulitple Cascading combo boxes

gumbi17

Registered User.
Local time
Today, 02:46
Joined
Aug 23, 2011
Messages
43
Alright I am still new to the VBA world but I am giving my coding a try, and so far it is no good. Here is the problem, I have a combo box that pulls down 36 different selections. Each of the 36 selections all have different responses and as well a different value. So if the user pulls down the first selection from cboCode then he will need to have it redirect the next combo box cboResponse to show from codes-Yes1 (Response column) and also have another combo box cboValue (Raw column) to show from Codes-Value1. I know this should be an easy but long If elseif statement but I am not doing as well I think with it or it least it doesn't look right and I want to be on the right path before wasting a ton of work.

If Me.cboCode = cboCode.Column(2)"1" Then
Me.cboResponse.RowSource = [codes-Yes]![Response]
Me.cboValue.RowSource = [code-Value1]![Raw]
Elseif
Me.cboCode = cboCode.Column(2)"2" Then

and etc.

End If
 
I understand... nothing.
If you will be able to explain this for me, a nonnative English speaker, then I am sure that you will gain help.
 
well.... i do it like this, if you want a non expert solution
if you have data for both comboboxes in one table

set first box data something like this
SELECT DISTINCT Predloge.TemplGroup FROM Predloge;

create after update event for your first combobox that defines the source for the second combo box

Me.txtTG.RowSource = "SELECT TemplName FROM predloge WHERE TemplGroup ='" & Me.txtGrupa & "'"

for the third value, I'd use dlookup on afterupdate event, if I got you riight

edit: if you just want to define values for 2 comboboxes with the first combobox then just put two rowsource sentences for each one
 
Last edited:
I am not understanding the Predloge or the Grupa? Are these supposed to be the table name? If you could use the examples I used that might help a little better understand.
 

Users who are viewing this thread

Back
Top Bottom