An
Option Group isn't boolean, it doesn't return
True/False. Instead, an
Option Group returns the value assigned to the given button/checkbox. The first item in the Group returns a
1, the second a
2, and so forth. If the name of your
Option Group frame is
YourOptionFrame (clever isn't it?) this code will do the trick:
- Private Sub YourOptionFrame_Click()
-
Select Case YourOptionFrame
-
Case 1
-
'Code here to print "Report1"
-
Case 2
-
'Code here to print "Report2"
-
End Select
-
End Sub
-
You could also use
- Private Sub YourOptionFrame_Click()
-
If YourOptionFrame = 1 Then
-
'Code here to print "Report1"
-
ElseIf YourOptionFrame = 2 Then
-
'Code here to print "Report2"
-
End IF
-
End Sub
-
With just a couple of choices it probably doesn't matter which you use, but the first example, using the Select Case construct, makes things much clearer when you have a number of choices.
You could use the same code behind a command button, to be clicked after chosing a button.
BTW, Delerna's advice on giving meaningful names to controls is spot on!
Linq
;0)>