OK, basically I have about 24 option buttons on my form. 4 of them per frame totalling 6 frames. When they click a button I want it to make sure that at least one option button is ticked in each frame, without having to do loads and loads of IF statements to check this. Is there a way to check that one is checked per frame?
I dont want default value of one of the opt buttons in each frame to be 1 incase a user thinks they ticked it as the form is pretty complex and having boxes ticked when they open it will confuse them.
If you can help then please do. Just to summarise, I need to make sure at least 1 option button is ticked per frame, hopefully without using too much code.
Ifs will be necessary, however, you can keep them at a minimum if you use 1 boolean flag for each frame, and set it to true every time the user ticks an option in that frame, and set it to false every time they unclick one. Then you will only need the following style if statement
VB Code:
If flag1 AND flag2 AND flag3 AND flag4 AND flag5 AND flag6 Then
Msgbox "Form Filled Correctly"
Else
Msgbox "Missing data"
End If
Hope this helps.
We don't know what's wrong. . . So the best bet might be to remove something surgically.
well.. you could always loop through each frame, like this:
Dim OptBut As OptionButton
for each optbut in frame1
if optbut.value = vbchecked then msgbox "checked in the frame"
next
and do that for each frame, and maybe exit sub or some kind of jump if it isn't for the whole frame, and at th end it will be the message that says they al were checked.
Remember, if someone's post was not helpful, you can always rate their post negatively .