Results 1 to 5 of 5
  1. #1
    adrianf44 is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Apr 2018
    Posts
    11

    Creating a filter

    Hi all,

    All of my contacts are assigned a Status, such as Green, Amber, Red, or Black. I'm using [Forms]![Main]![ComboFilterStatus] as the criteria in my query for my ListBox of contacts so I can filter by status. When I open my form, I want the ListBox to, by default, show only those Contacts who are NOT Black. I also have "Not Black" as a 5th option in my ComboFilterStatus so if I filter by Green, Amber, or Red, I have the ability to go back to my "Not Black" contacts. Thanks for any input!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    So what is the issue? How to switch the listbox from NOT BLACK to a selected color and back?

    WHERE Status LIKE IIf([Forms]![Main]![ComboFilterStatus]="Not Black", "*", [Forms]![Main]![ComboFilterStatus])
    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
    adrianf44 is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Apr 2018
    Posts
    11
    Quote Originally Posted by June7 View Post
    So what is the issue? How to switch the listbox from NOT BLACK to a selected color and back?

    WHERE Status LIKE IIf([Forms]![Main]![ComboFilterStatus]="Not Black", "*", [Forms]![Main]![ComboFilterStatus])
    The issue i'm running with the above is using * shows ALL contacts, regardless of their Status. I would like my Not Black filter to only show Green, Amber, and Red.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Sorry for my misunderstanding. Try:

    WHERE Status LIKE IIf([Forms]![Main]![ComboFilterStatus]="Not Black", "[!B]*", [Forms]![Main]![ComboFilterStatus])
    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
    adrianf44 is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Apr 2018
    Posts
    11
    Quote Originally Posted by June7 View Post
    Sorry for my misunderstanding. Try:

    WHERE Status LIKE IIf([Forms]![Main]![ComboFilterStatus]="Not Black", "[!B]*", [Forms]![Main]![ComboFilterStatus])
    Simple solution yet I just couldn't think of it... thank you, works perfect!

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

Similar Threads

  1. Creating a filter for continuous forms
    By NJMike64 in forum Macros
    Replies: 2
    Last Post: 02-17-2016, 10:44 AM
  2. Replies: 1
    Last Post: 08-14-2012, 02:43 PM
  3. Creating FILTER Buttons
    By Kipster1203 in forum Forms
    Replies: 9
    Last Post: 06-17-2010, 09:31 AM
  4. Creating a simple filter
    By Kipster1203 in forum Reports
    Replies: 3
    Last Post: 05-18-2010, 10:00 AM
  5. Replies: 19
    Last Post: 05-12-2009, 02:59 PM

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