How Filter a Subform in a Subform?

  • Thread starter Thread starter David Habercom
  • Start date Start date
D

David Habercom

I have a subform (A) with two subforms (A1 & A2) side-by-side. I am trying
to filter the items in A2 based on a selection in A1. Can anyone tell me
the command structure for doing that? And where should the module with
command be -- in A, A1 or A2? Thanks.
David
 
Code should be in the Current event of A1. Code should set the filter in
A2 to the key of the current record of A1 and turn the filter on:

Me.Parent.Form.sfA2.Filter = "KeyID = " & Me!KeyID
Me.Parent.Form.sfA2.FilterOn = True

This assumes that A1 and A2 belong to the same parent and their controls
are called sfA1 and sfA2.
Make sure that Parent/Child relationship is disabled for A2. In fact, A2
is not truly a "subform" - it is fairly independent but just appear
embedded into A.
Pavel
 
Back
Top