Help with option groups

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

Guest

I haven't used option groups before. I have created one on a form and am trying to use VBA code to get each radio button to run a report when the user clicks on it. However, the buttons are all shaded and won't respond. If I set the option group default value to one of the button's values, then that one shows as a default (black) and the others are clear (not shaded) but still none of them will respond

Also, I placed a command button on the form and coded it to generate a report based on the value of the option group. The option group default value is still determining what report I get when clicking on the command button. I still can't select a radio button of my choice and get the option group value to change accordingly

What am I missing
 
Be sure that your code for running the report is attached to the AfterUpdate
event of the option group.

The behavior that you describe when you have no default value is
appropriate. Setting a default value in the properties will not cause the
AfterUpdate event to run, however. That occurs only when the user clicks on
a button and changes the value of the option group.


--
Ken Snell
<MS ACCESS MVP>

ctdak said:
I haven't used option groups before. I have created one on a form and am
trying to use VBA code to get each radio button to run a report when the
user clicks on it. However, the buttons are all shaded and won't respond.
If I set the option group default value to one of the button's values, then
that one shows as a default (black) and the others are clear (not shaded)
but still none of them will respond.
Also, I placed a command button on the form and coded it to generate a
report based on the value of the option group. The option group default
value is still determining what report I get when clicking on the command
button. I still can't select a radio button of my choice and get the option
group value to change accordingly.
 
Ken
Thanks for the reply. I didn't know to associate the code with the AfterUpdate event of the option group, so I have done that now. However, it didn't help. Clicking on the option group buttons does nothing. The option group is just not working. I can't select any of the options. Any further ideas
ctda

----- Ken Snell wrote: ----

Be sure that your code for running the report is attached to the AfterUpdat
event of the option group

The behavior that you describe when you have no default value i
appropriate. Setting a default value in the properties will not cause th
AfterUpdate event to run, however. That occurs only when the user clicks o
a button and changes the value of the option group


--
Ken Snel
<MS ACCESS MVP

ctdak said:
I haven't used option groups before. I have created one on a form and a
trying to use VBA code to get each radio button to run a report when th
user clicks on it. However, the buttons are all shaded and won't respond
If I set the option group default value to one of the button's values, the
that one shows as a default (black) and the others are clear (not shaded
but still none of them will respondreport based on the value of the option group. The option group defaul
value is still determining what report I get when clicking on the comman
button. I still can't select a radio button of my choice and get the optio
group value to change accordingly
 
Ctdak,

Can you check the properties of the Option Group, and make sure Enabled
is set to Yes and Locked is set to No.
 
And check that each option button is actually a member of the option group.
It's possible that one or more of the buttons is existing as a "free"
control, not part of the option group. You may need to recreate the option
button to be sure.
 
The properties of the option group are OK, as are the properties of the buttons. None of the buttons are "free". Just to be sure, I recreated a new option group on the same form, applied buttons to it in one fell swoop, then deleted the old option group and it's buttons. I set the option group default to 1. Same result as before. Each button seems to receive the focus when I click on it, but the first button (the default) stays black and no code is executed. Even if I had no option group code, shouldn't the button clicked on go black

Below is my code assigned to the option group's AfterUpdate event. Is there something wrong with what I am doing code-wise here

Private Sub StatisticalReportsOptionGroup_AfterUpdate(
Forms!frm_MenuReports.Visible = Fals
Select Case StatisticalReportsOptionGrou
Case Is =
'Open report A in print previe
Case Is =
'Open report B in print previe
Case Is =
'Open report C in print previe
End Selec
End Su

ctda

----- Ken Snell wrote: ----

And check that each option button is actually a member of the option group
It's possible that one or more of the buttons is existing as a "free
control, not part of the option group. You may need to recreate the optio
button to be sure
 
Ctdak,

I can't see that it could have anything to do with your code. The code
is applicable after the value of the option group changes, but we're not
getting to that point.

Ok, here's another idea... Does the AllowEdits property of the form
happen to be set to No?
 
Steve
AllowEdits is set to Yes, but you were "barking up the right tree" here. I have "egg on face" - I discovered that the menu (switchboard) I was opening this form from was opening it in ReadOnly mode instead of Edit mode. O dear, my bad! I got you and Ken scratching your heads for nothing. Oh well. I really appreciate the responses from you both anyway. You actually helped me to finally track it down
ctda

----- Steve Schapel wrote: ----

Ctdak

I can't see that it could have anything to do with your code. The code
is applicable after the value of the option group changes, but we're not
getting to that point

Ok, here's another idea... Does the AllowEdits property of the form
happen to be set to No
 
Back
Top