Option Button to Enable List Box

H

HServ

I have two option buttons on a form. I want the second one to enable a list
box when it is clicked. Right now all I can do is say Yes or No to Enable in
the Properties box.

Example -- O View All
O View by Category

(ListBox) Category: Arts ^
Sports |
Teens V

So when you click "View by Category" you can choose from the list but when
you click "View All" you can't choose from the listbox, because you are
going to see them all anyway.
Thanks
 
K

Ken Snell [MVP]

Assuming that the two option buttons are part of an option group frame (I'll
assume the option group is named fraOptions), use the AfterUpdate event of
the frame (option group) to set the enabled property of the listbox:

Private Sub fraOptions_AfterUpdate()
Me.ListBoxName.Enabled = (Me.fraOptions.Value = 1)
End Sub

The above assumes that the value of the "View All" option button is 1.
--

Ken Snell
<MS ACCESS MVP>
 
Top