Private Sub Combo1_Change()

With Me.Combo2.Enabled = False

Select Case Me.Combo1
   Case "bob"
    Me.Combo2.Enabled = True
   Case "carol"
    Me.Combo2.Enabled = True
   Case "jeff"
    Me.Combo2.Enabled = False
    Case "freeda"
    Me.Combo2.Enabled = false

   Else: Combo2.Enabled = False

End Select

End Sub

Hi all , this code seems to be wrong as i cannot get the combo2 to become disabled as a result of choosing a value in combo1.
Any help would be appreciated very very very very muchly, with thanks
gruffy
This bit of code is not the real code i want to successfully instigate, but a simpler example to help m understand the premise etc....
(i mean i have more than these two in my program but need to understand the correct approach, so that i may apply it to all areas in program that require tis type of validatio or whatever it needs)
Thanks agian all peeps out there

Recommended Answers

All 2 Replies

Change combo box Event from Combo1_Change() to Combo1_Click() :

Private Sub Combo1_Click()
Select Case Me.Combo1
    Case "bob"
        Me.Combo2.Enabled = True
    Case "carol"
        Me.Combo2.Enabled = True
    Case "jeff"
        Me.Combo2.Enabled = False
    Case "freeda"
        Me.Combo2.Enabled = False
    Case Else ' this for case else
        Me.Combo2.Enabled = False
End Select
End Sub

Amazing, thankyou Jx_Man you sorted it right out, bloody obvious i guess, but sometimes teh simplest stuff escapes when your a bit tired (or in my case...Stupid !)
Thanks again Jx_Man, you rule !
Gruffy

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.