G
Guest
I am trying to filter a report with several different queries that are used
in a list box based on a value list.
I think the problem may be in the RunReport private sub but I'm not sure.
When I click the report button, no matter which value I have selected in the
list, it gives me the entire list. The name of my report is ActiveJobList.
I'm sure it's something simple I'm missing here but I'm new to VB and Access.
Here is my code. Thanks!
code:--------------------------------------------------------------------------------
Private Sub cmdReport_Click()
On Error GoTo Oops
Select Case ListAll.ListIndex
Case -1: MsgBox "Please choose the report to run."
Case 0: SourceQuery = "JobListAll"
Case 1: SourceQuery = "JobListChurch"
Case 2: SourceQuery = "JobListDesign"
Case 3: SourceQuery = "JobListMSP"
Case 4: SourceQuery = "JobListMSTP"
Case 5: SourceQuery = "JobListWillie"
Case 6: SourceQuery = "JobListSalem"
Case 7: SourceQuery = "Backlog"
End Select
RunReport
Exit Sub
Oops:
MsgBox "Error running the chosen report." & vbCrLf & Err.Number & " - "
& Err.Description
End Sub
Private Sub RunReport()
On Error GoTo Oops
If SourceQuery <> "" Then
DoCmd.OpenReport "ActiveJobList", acViewPreview
End If
Exit Sub
Oops:
Err.Raise Err.Number, "ActiveJobList.RunReport", Err.Description
End Sub
in a list box based on a value list.
I think the problem may be in the RunReport private sub but I'm not sure.
When I click the report button, no matter which value I have selected in the
list, it gives me the entire list. The name of my report is ActiveJobList.
I'm sure it's something simple I'm missing here but I'm new to VB and Access.
Here is my code. Thanks!
code:--------------------------------------------------------------------------------
Private Sub cmdReport_Click()
On Error GoTo Oops
Select Case ListAll.ListIndex
Case -1: MsgBox "Please choose the report to run."
Case 0: SourceQuery = "JobListAll"
Case 1: SourceQuery = "JobListChurch"
Case 2: SourceQuery = "JobListDesign"
Case 3: SourceQuery = "JobListMSP"
Case 4: SourceQuery = "JobListMSTP"
Case 5: SourceQuery = "JobListWillie"
Case 6: SourceQuery = "JobListSalem"
Case 7: SourceQuery = "Backlog"
End Select
RunReport
Exit Sub
Oops:
MsgBox "Error running the chosen report." & vbCrLf & Err.Number & " - "
& Err.Description
End Sub
Private Sub RunReport()
On Error GoTo Oops
If SourceQuery <> "" Then
DoCmd.OpenReport "ActiveJobList", acViewPreview
End If
Exit Sub
Oops:
Err.Raise Err.Number, "ActiveJobList.RunReport", Err.Description
End Sub