B
Bill Stanton
An aftermath of the "Sub-report problem" thread, I have not
been able to set the filter expression for the sub-report's
RecordSource. As you can see from the code, I attempted
to inherit the RecordSource and its filter properties from the
parent report. The three lines you see commented out DID
NOT work at all. Failing that, I put a global variable
"FltrDonSum" in a general module and set its value in the
OnOpen code of the main report. However, when I attempted
to execute the statement:
Me.Filter = "DOE = " & FltrDonSum
I get a Run-Time error 2101 "The setting you entered isn't
valid for this property". Yet, debug shows the filter to be
exactly what it should be.
What am I missing here?
Thanks,
Bill
Option Compare Database
Option Explicit
Private Sub Report_Open(Cancel As Integer)
Static Initialized As Boolean
If Not Initialized Then
'==================================
' Inherit RecordSource and filter from parent report
'==================================
' Me.RecordSource = Me.Parent.RecordSource
' Me.Filter = Me.Parent.Filter
' Me.FilterOn = True
Initialized = True 'Only run this code once
Me.Filter = "DOE = " & FltrDonSum
End If
End Sub
been able to set the filter expression for the sub-report's
RecordSource. As you can see from the code, I attempted
to inherit the RecordSource and its filter properties from the
parent report. The three lines you see commented out DID
NOT work at all. Failing that, I put a global variable
"FltrDonSum" in a general module and set its value in the
OnOpen code of the main report. However, when I attempted
to execute the statement:
Me.Filter = "DOE = " & FltrDonSum
I get a Run-Time error 2101 "The setting you entered isn't
valid for this property". Yet, debug shows the filter to be
exactly what it should be.
What am I missing here?
Thanks,
Bill
Option Compare Database
Option Explicit
Private Sub Report_Open(Cancel As Integer)
Static Initialized As Boolean
If Not Initialized Then
'==================================
' Inherit RecordSource and filter from parent report
'==================================
' Me.RecordSource = Me.Parent.RecordSource
' Me.Filter = Me.Parent.Filter
' Me.FilterOn = True
Initialized = True 'Only run this code once
Me.Filter = "DOE = " & FltrDonSum
End If
End Sub