Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove filter on Subform but not on Parent form

Status
Not open for further replies.

jdttek

Technical User
May 8, 2002
112
0
0
US
I have a main form that is already filtered when opened (using cmd btn on previous form that selects only certain data to display when new form is opened).

Then, when I use "filter by selection" on my subform, it works fine. Problem is, when I then do remove filter on the subform it removes the filter on BOTH the parent form and the subform. I am tying to remove the filter on the subform only, leaving the mainform still filtered.

Example:
1. Cmd button on Acct List form opens Account Detail form for the record selected on the Account List.
2. Invoice subform on Account Detail form shows all invoices.
3. Filter on subform to show only open invoices works fine.
4. Then, when release that filter, all invoices are shown BUT main form also shows ALL accounts and not just the originally selected account from step 1.
I need the main form to remain restricted to the originally selected account, with the subform showing all invoices again once filter is released.

Any I 1deas how to accomplish this? Thanks.

JDTTEK
 
Instead of removing the filter using the main toolbar button (or a wizard-built copy on your form) create a custom button on the main form.

Save the filter in a global string when the form is launched (in the FormOpen event) and restore the filter to the value in the string when your custom button (btnRemoveFilter) is clicked.

dim sFilter as string

sub FormOpen(Cancel as Integer)
sFilter = me.filter
end sub

sub btnRemoveFilter_Click()
me.filter = sFilter
me.requery
end sub

or something like that.

Use the command button wizard to create the button as a "apply form filter" button then strip out all the wizard's code. that gives you a nice icon on the button.

That should do what you want.

Ian.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top