Changed Option Group Not Working Properly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I changed an option group slightly and now it doesn't behave the way it used to. I changed a "SelectCategory" to 2 columns instead of 1. The option group has 2 radio buttons where selecting the second button "wakes up" the "SelectCategory". When I open the dialog form, radio button 1 has focus, but the SelectCategory is lit up. If I select the second radio button and then the first one, the SelectCategory gets grayed out. When I remove the second column (back to the way it was originally), all works as it should. What's up

tia
JMorrel
 
So you have an option group (frame) that contains two option buttons (radio
buttons), and you also have a combo box called "Select Category", which you
only want enabled when the second button is selected.

You say, at present, the combo box is enabled when you open the form. Is
that correct?

If so, then you should add the following code to the form's Current event:
Me.SelectCategory.Enabled = (Me.fraMyOptionGroup = 2)

....where SelectCategory is the combo box, and fraMyOptionGroup is the option
group frame.

Note: You can also put the same code in the option group's AfterUpdate
event.

You also say that it stopped working correctly when you changed the combo
box to 2 columns. Make sure you changed the following combo box properties:
RowSource - to ensure the query is returning two columns.
ColumnCount - to indicate the number of columns returned by the
RowSource (in this case, 2).
ColumnWidths - to reflect the width of each column returned by
RowSource. If you don't want a particular column to display, set it at zero.
BoundColumn - to reflect the column that will be saved to the field
listed in ControlSource.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


JMorrell said:
I changed an option group slightly and now it doesn't behave the way it
used to. I changed a "SelectCategory" to 2 columns instead of 1. The
option group has 2 radio buttons where selecting the second button "wakes
up" the "SelectCategory". When I open the dialog form, radio button 1 has
focus, but the SelectCategory is lit up. If I select the second radio
button and then the first one, the SelectCategory gets grayed out. When I
remove the second column (back to the way it was originally), all works as
it should. What's up?
 
If the option group is bound, that is, its value is saved to the underlyng
table, then I would use the syntax I gave you:
Me.SelectCategory.Enabled = (Me.fraMyOptionGroup = 2)

That way, SelectCategory's status will be set automatically whenever you
navigate to a record.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


JMorrell said:
Thank you for your reply. I got it to work the way I had intended by
setting the form's "OnOpen" event to Me!SelectCategory.Enabled = False.
This assures that every time the form is opened, the list box is grayed out.
I don't know if this causes other problems, but it makes sure that the value
is always initially false. What are your thoughts on doing it this way.
 
Back
Top