Val
I have experienced this problem before.
You can not use the Filter and FilterOn events on a subreport.
I have created a complex report manager where I can select a report from a group and then depending on the report
filter on fields from both the main & sub reports.
I found the easiest way to make this work was to use code to temporarily change the Sub-Reports RecordSource SQL string and add WHERE clause to the end of it with the filter criteria.
Then the DoCmd.OpenReport
Then restore the Sub-reports original RecordSource
Dim strReportName As String, strSubReportName As String
Dim strReportWhere As String, strReportSubWhere As String Dim strSubReportQuery As String
Dim strSQL As String
Dim qdf As DAO.QueryDef
strReportName = Me![Selected Report]
strReportWhere = ReportWhere()
strSubReportName = Me![Selected Report].Column(4)
If strSubReportQuery = "" Then
Else
strReportSubWhere = ReportSubWhere()
End If
If strReportSubWhere = "" Then
DoCmd.OpenReport strReportName,intPrintMode,,strReportWhere
Else
strSubReportQuery = Me![Selected report].Column(5)
Set qdf = currentDB().QueryDefs(strSubReportQuery)
strSQL = qdf.SQL
qdf.SQL = Left(qdf.SQL,Len(qdf.SQL)-3)& strReportSubWhere
DoCmd.OpenReport strReportName,,,strReportWhere
qdf.SQL = strSQL
End If
I hope this helps.
Robert