enable/disable combo box

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.
 
R

ruralguy via AccessMonster.com

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
 
K

Klatuu

If the option buttons belong to an option group, use the After Update event
of the option group frame.
 
R

ruralguy via AccessMonster.com

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]
 
K

Klatuu

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.
 
Top