[AccessD] Filter Main Form with Subform...

Robert robert at servicexp.com
Mon Jun 23 06:39:57 CDT 2008


I'm trying to filter the main form (and a 2nd subform) from a selection in
the 1st subform like this.. (Both subforms are not linked whatsoever they
just sit on the main form)  Access 2007 (but does the same thing in 2003)


Me.parent.form.filter = "[Customer ID] = " & CID
Me.parent.form.filterOn = True

Me.parent.ctrsubform.form.filter = "[lEKey] = " & m_lEKey
Me.parent.ctrsubform.form.filterOn = True


The problem is when the code hits the first Me.parent.form.filter =
"[Customer ID] = " & CID, the 1st subform requery, and the record position
the user selected is lost (record at top of list is highlighted). (But the
main form (and 2nd subform are filtered  correctly)

I have tried to store the Bookmark and re-apply but for some reason I can't
grab a valid Bookmark from the subform.

So I ended up using the subform PK to perform a search and then move to the
record that was selected in the subform. 

The problem with this approach is it takes a bit of time to complete the
cycle and re-look up the selected record. Is there a way to keep the 1st
subfrom from requiring?


PS: I'm terrible at SQL....


TIA
~Robert













More information about the AccessD mailing list