I have a Client form with a number of subforms on it (ClientType,
ClientInterest, etc). The subforms list the one-to-many relationship of
Client to ClientType and Client to ClientInterest.
When I use "Filter by Form" each subform gets the filter not the
parent form. What I get is that for each Client (and it still lists all
clients) each subform only shows those ClientType or Interest records
that match the filter for the subform. I understand why this occurs.
Each subform has its filter in place and doesn't impact the selection
of Client records just the selection of records in its subform.
What I want is for the criteria specified in the filter of a subform to
actually filter the records selected in the parent Client form. I think
this is a reasonable and intuitive thing for "Filter by Form" to do. Is
there a simple way to achieve this?
I am in the process of implementing "SELECT * FROM Client WHERE ClientID
IN (SELECT ClientID FROM ClientType WHERE Type = "xxx" OR Type = "yyy")".
I believe this will work and am wondering if others have had this problem
and what their solutions were.
The other problem I have is that the ApplyFilter Event gets presented to
forms/subforms in a problematic order. The form gets the event first
and then the subforms. This means that the form is applying its filter
before the subforms have been interrogated for their details. And then
when they are I need to send the filter back to the parent form and remove
it from the subform. This little filter double shuffle seems to be
causing MSACCESS.EXE to abort. Whenever I run the filter code that I have
in place Acccess crashes. Firstly, I am impressed that I can write event
code in VB that affects the Access environment so fundamentally. Secondly,
what am I doing wrong and how do I not do it? One thought I have had is
that when I set the Filter on the Parent form I use:
...Filter = strFilterArgument
...FilterOn = true
I have seen this done but in the reverse order, Ie:
...FilterOn = true
...Filter = strFilterArgument
Does anyone have an opinion on whether this could be related to the crash?
Thanks in advance, Greg Shaw.