enable/disable combo box

  • Thread starter Thread starter Bobby.Dannels
  • Start date Start date
B

Bobby.Dannels

I have a form with two option buttons. "optAll" and "optSection". I
need optAll to disable a combo box "cboFilter" and I need "optSection"
to enable the same combo box.
 
In the Click code event of the optAll button put:
Me.cboFilter.Enabled = False
...and in the Click code event of the optSection button put:
Me.cboFilter.Enabled = True
 
If the option buttons belong to an option group, use the After Update event
of the option group frame.
 
Klatuu has a good point. If that is the case then you will need to test for
the value of the OptionGroup to see which button was just pushed. ie:
If Me.OptionGroup = 1 Then
Me.cboFilter.Enabled = False
Else
Me.cboFilter.Enabled = True
End If
...using your control names of course.

If the option buttons belong to an option group, use the After Update event
of the option group frame.
In the Click code event of the optAll button put:
Me.cboFilter.Enabled = False
[quoted text clipped - 4 lines]
 
That would be correct. How about a minimalist's approach to that code:

Me.cboFilter.Enabled = Me.OptionGroup <> 1

--
Dave Hargis, Microsoft Access MVP


ruralguy via AccessMonster.com said:
Klatuu has a good point. If that is the case then you will need to test for
the value of the OptionGroup to see which button was just pushed. ie:
If Me.OptionGroup = 1 Then
Me.cboFilter.Enabled = False
Else
Me.cboFilter.Enabled = True
End If
...using your control names of course.

If the option buttons belong to an option group, use the After Update event
of the option group frame.
In the Click code event of the optAll button put:
Me.cboFilter.Enabled = False
[quoted text clipped - 4 lines]
need optAll to disable a combo box "cboFilter" and I need "optSection"
to enable the same combo box.

--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
Back
Top