03856me
Active Member
- Joined
- Apr 4, 2008
- Messages
- 297
I have a userform with textboxes/labels that are hidden unless certain choices are made in a combobox. The code is working as expected with one exception: The exit event triggers the correct boxes to become visible and clears and hides the right ones - in the tab order they are directly after the combo box - but the focus is not on the now visible one. I have the code in an exit event, I also tried AfterUpdate event but it works the same way. This code basically ignores the tab order. What am I missing?
Code:
Private Sub cbo_machctr_Exit(ByVal Cancel As MSForms.ReturnBoolean)
cbo_machctr.BackColor = &HFFFFFF
If cbo_machctr.Value = "Boiler" Then
Me.lbl_function.Visible = True
Me.cbo_boilerfunction.Visible = True
Me.cbo_kilnfunction.Value = ""
Me.cbo_kilnfunction.Visible = False
Else
If cbo_machctr.Value = "Kiln" Then
Me.lbl_function.Visible = True
Me.cbo_kilnfunction.Visible = True
Me.cbo_boilerfunction.Value = ""
Me.cbo_boilerfunction.Visible = False
Else
Me.lbl_function.Visible = False
Me.cbo_boilerfunction.Visible = False
Me.cbo_kilnfunction.Visible = False
End If
End If
End Sub