
Making radio (option) buttons toggle
Hi Bill,
Unfortunately, I don't think you are going to be able to achieve this in the
way you envisage. There are 3 options:
(1) have an extra optionbutton at the end of the list "Don't List Lead
Author" - this is the accepted method.
(2) have a commandbutton ("Clear Selection") that set's all the optionbutton
values to False.
(3) Use checkboxes instead. You can make these behave like option buttons by
adding some code that unchecks the other checkboxes when one is checked. In
the mousedown event of each checkbox, you can test whether it is already
checked - if so, uncheck *all* the checkboxes. If not, check that box, and
uncheck the rest. You'll need to experiment to find which events to use.
--
Hope this helps.
Regards
ibby
Please post replies or follow-ups to the **newsgroup** so that participants
may benefit or contribute.
Quote:
> I have a form with a set of option buttons -- one for each listed author
of
> a document. The user clicks one to indicate the lead author, or
"principal
> investigator." In general, the designation corresponds well with the way
> option buttons work, one author is the lead, and sometimes they pass the
> title around.
> However, we had a case where the lead author decided not to be listed on
the
> report. It would be nice to be able to click on the selected option
button
> and have its value change to zero (unselect it without selecting another
> button). I've tried tinkering with various events (Click, MouseDown,
> MouseUp, Change, BeforeUpdate), and I can't get it to produce this
behavior.
> If I insert a MsgBox() after a MouseUp routine that toggles the Option
> button's value, the value of the option button will toggle, apparently
> because the MsgBox steals the focus before the Option button has the
> opportunity to change back.
> I'm assuming that the fact that the Option button has the focus at some
late
> point (event), its value is forced to -1 (True), no matter how I change
the
> value at some earlier point.
> I tried tossing in a DoCmd.GoTo() to force the focus away from the Option
> button before it had the chance to change back, but the DoCmd caused an
> error. Anyway ... I was able to come up with a workaround to solve the
> problem for my users, just not a toggle. anyone got any brighter ideas
than
> mine on this score?
> thanks,
> -Bill