Results 1 to 5 of 5
  1. #1
    Aaron5714 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    48

    VBA Code To Remove Filter From Specific Field

    I have a datasheet embedded as a subform. On the main form I want to have a button that will remove a filter set on a specific field in the subform. If the user has set filters on other fields in the subform (using the built-in quick filters) I want to preserve those filters. Is there a way to clear a filter from a specific field without affecting filters that may be set on other fields?



    My only idea was to read the subform's Filter property which would return a string with all active filters, then search this string for the field name in question (perhaps using an InStr function) and then work out some logic to delete that portion of the string. Just wondering if there is a more straight-forward way of doing this.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I am not aware of the Quick Access Toolbar having the option to filter forms. However, if disabling the control so the user can not filter it is not an option, I can only imagine "parsing" the string as an option.

  3. #3
    Aaron5714 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    48
    What I mean by "quick filters" is the filters that a user can select when they click the column headings in a datasheet form; it will open a little menu that allows you to check/uncheck specific values or input a text filter. I thought they were called "quick filters" but I may be wrong. This is different than the Quick Access Toolbar.

    Anyway, parsing the string may be the only solution although I was hoping to avoid that approach.

    Quote Originally Posted by ItsMe View Post
    I am not aware of the Quick Access Toolbar having the option to filter forms. However, if disabling the control so the user can not filter it is not an option, I can only imagine "parsing" the string as an option.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Thanks for the explanation. I am still trying to learn the Ribbons and Toolbar options in 2010.

  5. #5
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Yep, they're called "quick filters". As far as I can tell, parsing the form's Filter is going to be your only option, since there doesn't seem to be any documentation regarding a VBA option for turning a particular field filter on or off.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 07-21-2012, 10:20 PM
  2. remove toggle filter button!?
    By Wombat in forum Access
    Replies: 1
    Last Post: 05-16-2012, 01:50 PM
  3. Remove filter
    By jalb in forum Forms
    Replies: 6
    Last Post: 01-25-2012, 02:56 PM
  4. How do I remove a filter
    By cowboy in forum Forms
    Replies: 7
    Last Post: 04-21-2010, 10:13 AM
  5. Remove Filter and GoToRecord
    By ombadboy in forum Programming
    Replies: 0
    Last Post: 09-04-2009, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums