Ms Access VBA Code - Apply and remove a filter

I have a form with a combo box where the user selects a value from the list.
I then have a query that uses this value as the imput to a filter
Next on the After update of the combo box I set the filter using the code
   DoCmd.ApplyFilter "Q-300-03QFServiceCo"

Questions:
What VBA Code can I use to remove the filter and return to the all records view?
What event should I use to to remove this filter? Add a button "Remover Filter"
Is there a more efficient method to set this filter from VBA code without using the Query and remove it when desired?.

Thanks all for your assistance

Ldufresne
LVL 1
Lou DufresneIT Business Analyst CSM / Project ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dqmqCommented:
docmd.showallrecords reverses the filter.

The technique of preference is up to you and your users.  A button is fine.  I prefer adding a "dummy" entry in the combo box like "<none>"  that removes the filter.   You can also just rely on the Access menus and buttons for removing filters.

Rather than filters, a more common technique is to reference the combobox in criteria of a query that limits the dataset you are working with.  
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rey Obrero (Capricorn1)Commented:
private sub cmdClearFilter_click()
me.filter=""
me.requery
end sub

to set the filter in the afterupdate event of the combo

private sub combo1_afterupdate()
me.filter="[fieldName]='" & me.combo1 &"'"
me.filteron=true
end if
0
Lou DufresneIT Business Analyst CSM / Project ManagerAuthor Commented:
Thanks Both of you
I appreciate you suggestions

Ldufresne
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.