D
DocBrown
I have a report that has a group section. In the group header section I have
a subreport where I want to generate cumulative data of the records that have
been grouped. The cumulative data is extracted from a related table that has
a one to many relationship to the data in the main table.
Is there a way to pass a filter from a parent report to the subreport? I get
the error:
Run-time error '2101: The setting you entered isn't valid for this property.
The code is:
Private Sub Report_Open(Cancel As Integer)
Dim FormQuery As Form
Debug.Print "Report_open: " + Me.Name
If intCallCount = 0 Then
Set FormQuery = Forms("Report Query Prompts")
Debug.Print "FormQuery: " + FormQuery.Filter
Me.Filter = FormQuery.Filter
Me.FilterOn = False
intCallCount = intCallCount + 1
End If
End Sub
The Debug.print statements are getting just what I want. The If statement
makes this execute only on the first report open. It doesn't matter what I
put in the Me.Filter assignment. If I put Me.Filter = "" it still fails.
I suspect that at the time the subreport is opening, Access is not allowing
any changes to the form's properties. How can I get the sub report to filter
or get the records I want.
Thanks
a subreport where I want to generate cumulative data of the records that have
been grouped. The cumulative data is extracted from a related table that has
a one to many relationship to the data in the main table.
Is there a way to pass a filter from a parent report to the subreport? I get
the error:
Run-time error '2101: The setting you entered isn't valid for this property.
The code is:
Private Sub Report_Open(Cancel As Integer)
Dim FormQuery As Form
Debug.Print "Report_open: " + Me.Name
If intCallCount = 0 Then
Set FormQuery = Forms("Report Query Prompts")
Debug.Print "FormQuery: " + FormQuery.Filter
Me.Filter = FormQuery.Filter
Me.FilterOn = False
intCallCount = intCallCount + 1
End If
End Sub
The Debug.print statements are getting just what I want. The If statement
makes this execute only on the first report open. It doesn't matter what I
put in the Me.Filter assignment. If I put Me.Filter = "" it still fails.
I suspect that at the time the subreport is opening, Access is not allowing
any changes to the form's properties. How can I get the sub report to filter
or get the records I want.
Thanks