Results 1 to 2 of 2
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Toggle Filter on and off

    I have a combo box that is used to filter the records displayed in a form. Initially all records are displayed. When the user makes a selection from the list, only the matching records are displayed. I'd like to use the same control to remove the filter and display all records, but the list is contolled by a table. I don't want to add show all to the table.

    What do I do?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    One way is to UNION a " Select All" value into the RowSource:
    SELECT " Select All" As Criteria FROM tablename
    UNION SELECT fieldname FROM tablename;

    Then in the combobox AfterUpdate event VBA code sets Filter:
    Code:
    If Me.Combo0 = " Select All" Then
        Me.FilterOn = False
    Else
        Me.Filter = "fieldname='" & Forms!form1!Combo0 & "'"
        Me.FilterOn = True
    End If
    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. Toggle windows within Access
    By prstoessel in forum Access
    Replies: 2
    Last Post: 08-04-2011, 01:45 PM
  2. Toggle Button on Bound Form
    By P5C768 in forum Forms
    Replies: 7
    Last Post: 12-30-2010, 03:00 PM
  3. Disable toggle off option
    By Gryphen957 in forum Forms
    Replies: 1
    Last Post: 11-19-2010, 03:08 PM
  4. Toggle Button Options
    By Matthieu in forum Forms
    Replies: 2
    Last Post: 11-23-2009, 04:05 PM
  5. Toggle checkbox
    By stewarta in forum Programming
    Replies: 9
    Last Post: 04-16-2009, 02:45 PM

Tags for this Thread

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