C
Chuck
I have a form based on qrySalesReport. The form has an option group
[ReportType] and an unbound combo box, the combo box indicates a year (ie.
2007) and i would like all records from the query to be within 2007
[IssueDate] and when option group 2 is selected, i would like to filter on
field [Product] to only include records where the product name begins with
"INS *" and is wild carded after that. here is the start of my code. thanks
in advance
Private Sub Preview_Report_Click()
On Error GoTo Err_Preview_Report_Click
Dim stDocName As String
Dim strWhere As String
Select Case Me.[ReportType].Value
Case 1 ' Show all Records
'DoCmd.ShowAllRecords
stDocName = "rptSalesInsurance"
DoCmd.OpenReport stDocName, acPreview
Case 2 ' Insurance Report
strWhere = tblInsurance.Product Like "INS %"
stDocName = "rptSalesInsurance"
DoCmd.OpenReport stDocName, acPreview, , strWhere
End Select
Exit_Preview_Report_Click:
Exit Sub
Err_Preview_Report_Click:
MsgBox Err.Description
Resume Exit_Preview_Report_Click
End Sub
[ReportType] and an unbound combo box, the combo box indicates a year (ie.
2007) and i would like all records from the query to be within 2007
[IssueDate] and when option group 2 is selected, i would like to filter on
field [Product] to only include records where the product name begins with
"INS *" and is wild carded after that. here is the start of my code. thanks
in advance
Private Sub Preview_Report_Click()
On Error GoTo Err_Preview_Report_Click
Dim stDocName As String
Dim strWhere As String
Select Case Me.[ReportType].Value
Case 1 ' Show all Records
'DoCmd.ShowAllRecords
stDocName = "rptSalesInsurance"
DoCmd.OpenReport stDocName, acPreview
Case 2 ' Insurance Report
strWhere = tblInsurance.Product Like "INS %"
stDocName = "rptSalesInsurance"
DoCmd.OpenReport stDocName, acPreview, , strWhere
End Select
Exit_Preview_Report_Click:
Exit Sub
Err_Preview_Report_Click:
MsgBox Err.Description
Resume Exit_Preview_Report_Click
End Sub