nuno_coelho
08-17-2016, 02:54 PM
First ever post on this forum so hello to all!
I have been learning about VBA through web resources and am now starting to experiment with it in my job.
I ran into the first problem that I haven't been able to solve for myself so I am submitting it here in the hopes that somebody can help me out understand why the code is not working.
I have a userform which looks like this:
16899
I want the combobox "Departamento" to display a certain list which will depend on which of the option buttons is activated. I.e., if the option button BIC is activated, a specific BIC-list appears on the combobox "departamento" below it. If Pro-Organica or BIB is activated, then another list will appear as input for the combobox "departamentos".
As code for my combobox "Departamento", I have this:
Private Sub cb_depto_Click()
If Me.ob_bic = True Then
Me.cb_depto.RowSource = "lista_centrosBIC"
ElseIf Me.ob_bib = True Or Me.ob_PO = True Then
Me.cb_depto.RowSource = "lista_centrosBIB"
End If
End Sub
So, pretty straightforward. A click event on the combobox activates a certain RowSource property depending on which option button is considered as TRUE.
Problem is, nothing happens. No error or other, but it always remains blank.
I can't seem to figure out what is wrong in my coding logic.
Could any one help me understand this?
Thanks a lot in advance.
-Nuno
I have been learning about VBA through web resources and am now starting to experiment with it in my job.
I ran into the first problem that I haven't been able to solve for myself so I am submitting it here in the hopes that somebody can help me out understand why the code is not working.
I have a userform which looks like this:
16899
I want the combobox "Departamento" to display a certain list which will depend on which of the option buttons is activated. I.e., if the option button BIC is activated, a specific BIC-list appears on the combobox "departamento" below it. If Pro-Organica or BIB is activated, then another list will appear as input for the combobox "departamentos".
As code for my combobox "Departamento", I have this:
Private Sub cb_depto_Click()
If Me.ob_bic = True Then
Me.cb_depto.RowSource = "lista_centrosBIC"
ElseIf Me.ob_bib = True Or Me.ob_PO = True Then
Me.cb_depto.RowSource = "lista_centrosBIB"
End If
End Sub
So, pretty straightforward. A click event on the combobox activates a certain RowSource property depending on which option button is considered as TRUE.
Problem is, nothing happens. No error or other, but it always remains blank.
I can't seem to figure out what is wrong in my coding logic.
Could any one help me understand this?
Thanks a lot in advance.
-Nuno