PDA

View Full Version : Solved: Enable command button if in group of option button one option is selected



hunsnowboard
03-22-2009, 01:08 AM
Hi Everyone! I have a problem with my form. The form has two groups of radio buttons or option buttons. Each group has three option buttons in it. Then the form also has a "Next" command button. By default the command button is disabled. I would like the command button to be enabled only if there is one option button selected in each of the groups. So if one option button is selected in group1 and also another option button is selected in group2 then the command button "Next" should be enabled. How can I do this? Thank you very much in advance!

Edit: the group of option buttons are placed in a frames = frame1 and frame2

Bob Phillips
03-22-2009, 05:41 AM
With Me

If (.OptionButton1 Or .OptionButton2 Or .OptionButton3) _
And (.OptionButton4 Or .OptionButton5 Or .OptionButton6) Then

MsgBox "OK"
End If
End With

hunsnowboard
03-22-2009, 07:05 AM
Hi Xld! Thank you for your help, I appreciate it! My problem is that I do not understand where to insert the code? To form or frame, or optionbutton or command button??? And instead of messagebox 'OK' I should use commanbutton.enable = true right?
Thank you!

Bob Phillips
03-22-2009, 10:03 AM
I can't tell you that as it is your design, your code, not mine. Wherever you decide the command button should be enabled is where you put it. It could be on the click of another button, o maybe in the click event of each optionbutton, there are many places.

lucas
03-22-2009, 10:50 AM
I always do things the hard way. Bob has tried but I just can't learn :(

Maybe this will give you some ideas.

hunsnowboard
03-28-2009, 06:56 AM
Thank you guys for the help! Working fine! Have a nice weekend!