|
Question : Option Group & Radio Buttons: Which Events To Use
|
|
I am modifying an existing database that is in production. One section of the main "entry" form includes an option group with several radio buttons. Depending on which radio button is selected other objects on the form (outside the option group) may be disabled or enabled, made visibile or invisible, etc.
The original developer put the code to handle this on the Click event for the option group, and the MouseUp events for each of the option buttons.
That all works fine and well, until the option group (or something within it) has focus, and the cursor/arrow keys are used. Then the value is moved between the option group's buttons (very rapidly I might add), circumventing all the intended logic!
Let's say option group frmHero has three option buttons: optBatMan, optTheTick, optSpiderman. frmSidekick also has three option buttons: optRobin, optBatgirl, and optArthur. If optBatMan is selected in frmHero, frmSideKick should be enabled/visible, option buttons optRobin and optBatgirl are enabled, and optArthur is disabled. If optTheTick is selected in frmHero, frmSidekick is still enabled/visable, but option button optArthur is the only enabled button. Spidey don't need anybody besides his bad self, so if he's selected frmSidekick should be invisible.
What events should be used on this?
I am experimenting now, but a second (third, and even fourth) opionion would be greatly appreciated as this is going into a production database.
Thanks In Advance,
Michael
|
|
Answer : Option Group & Radio Buttons: Which Events To Use
|
|
Use the AfterUpdate event of the option group. And on the Form Current event.
Private Sub Form_Current()
Select Case Me!frmHero Case 1 Me.frmSidekick.visible=True Case 2
end select
end sub
|
|
|
|