how to set a filter on a open form in microsoft access 2013 with vba

Posted on 2014-07-14
Medium Priority
Last Modified: 2014-07-14
i have an open form and i want that when i press some command it's will filter the form to show only records that the price is 150 how i set this with vba

something like this :
Me.Filter = "[price] = 150
  Me.FilterOn = True

Question by:bill201
  • 2
LVL 85

Accepted Solution

Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 40194851
Is that your exact code? Is so, there's some syntax issues:

Me.Filter = "price=150"
Me.FilterOn = True

If you're doing this from another form, you must refer to the form:

Forms("YourFom").Filter = "Price=150"
Forms("YourForm").FilterOn = True

Also, if you're dealing with a Subform, you'll have different syntax, so let us know.

Author Comment

ID: 40195241
thanks for your answer, it's was another syntax issue,thanks alot

Author Closing Comment

ID: 40195243
excellent thanks alot

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question