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.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top