Select Case Statement vs If ElseIf Statement
Posted on 2006-10-30
Simple form to send chosen report to printer with CRViewer91. Form has a Frame control with 3 Option Buttons, 2 Command Buttons. Following is code for the cmdSelect Report button.
Private Sub cmdSelectReport_Click()
'View Report and Print user choice
Dim Value As Boolean
Select Case Value
Case optAssist(0).Value = True
Case optBoard(1).Value = True
Case optAnnual(2).Value = True
'If optAssist(0).Value = True Then
'ElseIf optBoard(1).Value = True Then
'ElseIf optAnnual(2).Value = True Then
' ElseIf optGraph(3).Value = True Then
MsgBox "You have not made a selection" & vbCrLf & _
"Please select one option or press Cancel", 32, "Make Print Selection"
The Select Case code drops to he MsgBox when the click event is fired regardless is a button is checked or not checked.
The If ElseIf code that is commented out works like a charm with no problems but I know that the Case Statement will work. I'm missisng something simple in the Select Case statement I think. Any help appreciated