Results 1 to 14 of 14
  1. #1
    JustLearning is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    26

    Filter By Form and Apply Filter Buttons

    I'm trying to add Filter By Form and Apply Filter buttons to my form, but whenever I click on the Filter by Form button, the Apply Filter button can no longer be clicked. Is there any work around for this so I don't need the toolbar to apply filter?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    JustLearning is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    26
    Thanks, but my form has to filter through a bunch of boxes depending on different information, so I wouldn't be able to make a combo box for each one of them. I'm more looking for a reason/way why the button is not clickable

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Did you let the wizard create the buttons? I never use the wizards because they do things I don't like, such as code with macros. I use only VBA. I suspect there is code in the embedded macro that disables the ApplyFilter button. Why it would do that I have no idea. Would have to review code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    JustLearning is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    26
    I've used both kinds of buttons, all the buttons seem to grey out whenever I click on the Filter by Form button.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    What do you mean by 'both kinds of buttons' - macros and VBA? Which buttons grey out - on the ribbon?

    I will have to examine code. If you want to provide db, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    JustLearning is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    26
    I mean wizard created and non-wizard created. And greyed out as in the buttons themselves, I can still apply filter through the ribbon, but I'd rather not rely on that.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Again, I have to review code.

    Post code or attach db.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    JustLearning is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    26
    '------------------------------------------------------------
    ' Apply_Click
    '
    '------------------------------------------------------------
    Private Sub Apply_Click()
    On Error GoTo Apply_Click_Err


    ' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
    ' <UserInterfaceMacro For="Filter" Event="OnClick" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application" xmlns:a="http://schemas.microsoft.com/office/accessservices/200
    ' _AXL:9/11/forms"><Statements><Action Name="RunMenuCommand"><Argument Name="Command">FilterByForm</Argument></Action></Statements></UserInterfaceMacro>
    DoCmd.RunCommand acCmdApplyFilterSort




    Apply_Click_Exit:
    Exit Sub


    Apply_Click_Err:
    MsgBox Error$
    Resume Apply_Click_Exit


    End Sub




    '------------------------------------------------------------
    ' Apply_GotFocus
    '
    '------------------------------------------------------------
    Private Sub Apply_GotFocus()
    On Error GoTo Apply_GotFocus_Err


    ' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
    ' <UserInterfaceMacro For="Apply" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application" xmlns:a="http://schemas.microsoft.com/office/accessservices/2009/11/forms"><Stat
    ' _AXL:ements><Action Name="RunMenuCommand"><Argument Name="Command">ApplyFilterSort</Argument></Action></Statements></UserInterfaceMacro>
    DoCmd.RunCommand acCmdApplyFilterSort




    Apply_GotFocus_Exit:
    Exit Sub


    Apply_GotFocus_Err:
    MsgBox Error$
    Resume Apply_GotFocus_Exit


    End Sub




    '------------------------------------------------------------
    ' Apply_DblClick
    '
    '------------------------------------------------------------
    Private Sub Apply_DblClick(Cancel As Integer)
    On Error GoTo Apply_DblClick_Err


    ' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
    ' <UserInterfaceMacro For="Apply" Event="OnGotFocus" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application" xmlns:a="http://schemas.microsoft.com/office/accessservices/2
    ' _AXL:009/11/forms"><Statements><Action Name="RunMenuCommand"><Argument Name="Command">ApplyFilterSort</Argument></Action></Statements></UserInterfaceMacro>
    DoCmd.RunCommand acCmdApplyFilterSort




    Apply_DblClick_Exit:
    Exit Sub


    Apply_DblClick_Err:
    MsgBox Error$
    Resume Apply_DblClick_Exit


    End Sub

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why does that look like commented html code and why is it there if it is commented and not executing? Is this a web database?

    Why 3 events?

    I have never used acCmdApplyFilterSort and I see nothing to cause the buttons to disable. Maybe you need a button that removes the filter and that will then re-enable the buttons?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    JustLearning is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    26
    I converted the macros to vba using the button, I don't know what the html is. The other 2 events are superfluous, I was just trying to figure out ways to make it work without having to click on the button. I tried adding a button that removes the filter, but that button also becomes greyed out when filtering by form.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You are using a method for filtering I have never implemented. If you want to provide db, I will try to figure out what is happening. Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    Join Date
    Feb 2015
    Posts
    5
    Did this one get solved? I too have used the command button wizard to place 3 filter buttons at the top of my form ie filter by form, apply filter, clear filter. If I use the filter by form button I get the blank form so I can make my selection as expected. The problem is that this is now the only activity the form will allow. To apply the filter I need to use the ribbon command as the buttons on my form are effectively 'greyed out' ie unavailable. Is there a way to apply the filter once the form is in 'filter by form' mode without having to use the ribbon or other commands outside the form?

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    It would appear not but I've never used 'Filter by Form' so I am not well-versed in its subtleties.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Apply Filter similar to Field Filter
    By DatabaseIntern in forum Forms
    Replies: 1
    Last Post: 06-11-2012, 05:42 PM
  2. How to filter dates using an apply filter code.
    By Jgreenfield in forum Reports
    Replies: 4
    Last Post: 11-15-2011, 01:38 PM
  3. Apply Filter 2 criteria not applying
    By ahightower in forum Forms
    Replies: 4
    Last Post: 07-28-2011, 03:31 PM
  4. Option button to apply filter
    By catguy in forum Programming
    Replies: 4
    Last Post: 06-23-2011, 12:10 PM
  5. Apply filter command
    By miziri in forum Forms
    Replies: 6
    Last Post: 01-21-2010, 02:22 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