SteveL13
asked on
Trying to get select case to work with report
I'm using the following code to try to filter results on a report. Frame 47 is an option group on a the form. But Case 1 isn't working let alone the rest of them. Is my syntax wrong? When the report runs I 'm getting all records instead of the one as 1
Private Sub cmdTaskReport_Click()
On Error GoTo cmdTaskReport_Click_Err
Select Case Priority
Case 1
DoCmd.OpenReport "rptTasks", acViewPreview, , Me.Frame47.Value = 1, acWindowNormal
Case 2
'DoCmd.OpenReport "rptTasks", acViewPreview, , [Priority] = 2, acWindowNormal
Case 3
'DoCmd.OpenReport "rptTasks", acViewPreview, , [Priority] = 3, acWindowNormal
Case Else
DoCmd.OpenReport "rptTasks", acViewPreview, "", "", acNormal
End Select
cmdTaskReport_Click_Exit:
Exit Sub
cmdTaskReport_Click_Err:
MsgBox Error$
Resume cmdTaskReport_Click_Exit
End Sub
Private Sub cmdTaskReport_Click()
On Error GoTo cmdTaskReport_Click_Err
Select Case Priority
Case 1
DoCmd.OpenReport "rptTasks", acViewPreview, , Me.Frame47.Value = 1, acWindowNormal
Case 2
'DoCmd.OpenReport "rptTasks", acViewPreview, , [Priority] = 2, acWindowNormal
Case 3
'DoCmd.OpenReport "rptTasks", acViewPreview, , [Priority] = 3, acWindowNormal
Case Else
DoCmd.OpenReport "rptTasks", acViewPreview, "", "", acNormal
End Select
cmdTaskReport_Click_Exit:
Exit Sub
cmdTaskReport_Click_Err:
MsgBox Error$
Resume cmdTaskReport_Click_Exit
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or
Private Sub cmdTaskReport_Click()
DoCmd.OpenReport "rptTasks", acViewPreview, , "[Priority]= " & Me.Frame47.Value , acWindowNormal
Private Sub cmdTaskReport_Click()
DoCmd.OpenReport "rptTasks", acViewPreview, , "[Priority]= " & Me.Frame47.Value , acWindowNormal
ASKER
Perfect. Thank you.
Case 1
DoCmd.OpenReport "rptTasks", acViewPreview, , [Priority] = 1, acWindowNormal