R
Rob Parker
I have a form with two subforms, and I'm trying to apply the same
filtering - set in one subform - to both. I'm using the following code in
Subform1:
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
MsgBox "filter applied: FilterType = " & ApplyType
Me.Parent.Form.Controls("Subform2").Form.Filter = Me.Filter
Me.Parent.Form.Controls("Subform2").Form.FilterOn = Me.FilterOn
End Sub
This works fine when I apply a filter to the first subform. Unfortunately,
it doesn't work when I remove the filter from the first subform; the
ApplyFilter event is not triggered in that case. If I open Subform1 as a
standalone form, and apply or remove a filter, the ApplyFilter event is
triggered in both cases (with ApplyType = 1 when I set a filter, and
ApplyType = 0 when I remove the filter).
Why doesn't this work when Subform1 is a subform of a parent form, and
what's the workaround to get it to work (ie. to remove the filter from
Subform2 when it is removed from Subform1)?
TIA,
Rob
filtering - set in one subform - to both. I'm using the following code in
Subform1:
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
MsgBox "filter applied: FilterType = " & ApplyType
Me.Parent.Form.Controls("Subform2").Form.Filter = Me.Filter
Me.Parent.Form.Controls("Subform2").Form.FilterOn = Me.FilterOn
End Sub
This works fine when I apply a filter to the first subform. Unfortunately,
it doesn't work when I remove the filter from the first subform; the
ApplyFilter event is not triggered in that case. If I open Subform1 as a
standalone form, and apply or remove a filter, the ApplyFilter event is
triggered in both cases (with ApplyType = 1 when I set a filter, and
ApplyType = 0 when I remove the filter).
Why doesn't this work when Subform1 is a subform of a parent form, and
what's the workaround to get it to work (ie. to remove the filter from
Subform2 when it is removed from Subform1)?
TIA,
Rob