Event for Filter Off?

G

Guest

A form with a subdatasheet. After the user is done filtering records, the
main form has a cmdShowAllRecords button that removes the filter (FilterOn =
False) and changes text and color.

But I need a FilterOff Event to know when the user might remove the filter
via the toolbar button, or via the right-click 'Remove Sort/Filter', so that
I can change the text and color on cmdShowAllRecords, accordingly.

Is there a difference between the main form and subform FilterOn property?
or is the event only on the main form?
 
R

Rob Parker

You can use the ApplyFilter event, and check whether the ApplyType = 0.
That will occur regardless of how the user removes the filter.

A main form and any subform(s) will each have their own FilterOn property.
If you filter the main form, the parent/child links will automatically cause
the subform to display only reords from the filtered set displayed on the
main form. Applying a filter to the subform will filter the subforms
records without affecting the main form's records.

HTH,

Rob
 
R

Rob Parker

The Remove Filter command on a subform works perfectly well for me, and it
does precisely what I expect it to do - removes any filter applied to the
subform. It does not - and should not - affect any filter which is applied
to the main form.

Rob
 
G

Guest

Rob,

Sorry for the confusion--my meaning was:

The Remove Filter command DOES work, ie, removes the filter on a subform.
However, it does NOT trigger the ApplyFilter event on the subform,
apparently. Go figure. It triggers on the main form. So my work-around is to
have the ApplyFilter event w/ code in both the subform and the main form.

Thanks for your help.
 
R

Rob Parker

Wow! That is very strange. I've just tested again (using A2002), and I
find that the ApplyFilter event occurs on a subform when the filter is
applied, but not when it is removed. And the ApplyFilter event of the main
form does not trigger when the sub-form filter is applied, but does trigger
when the sub-form filter is removed.

Thanks for pointing that out. I can't recall having ever seen any mention
of that before - I certainly haven't noticed it myself. Must store that one
away for future forgetting ;-)

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top