Results 1 to 4 of 4
  1. #1
    GenestealerUK is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2013
    Posts
    2

    Need Criteria to display exact result or all results if field is null

    Hi guys,

    I have developed a league registration system for a SE London Veterans Associated Football league. (Edit: I am using Access 2003)

    The system is currently searchable by clicking a dropdown box at the top which the queries refer to.

    However a new team has just joined which has a similar name to another and it has caused me a headache.


    In my queries under the field criteria I currently have the code:
    Like "*" & [Forms]![mainmenu].[searchCombo1]

    which refers to the location of the searchbar.
    Due to the first part of the criteria if the search bar is empty this code displays all the records (which is a desired result)

    However with the new team the
    Like "*" & creates problems.

    Example:
    There is one team we shall call Supertown
    Now added to the league are an annoying team called AFC Supertown

    Now when the search bar requests Supertown it also brings up AFC Supertowns results. I intially deleted the Like "*" & hoping this would fix the problem. But of course this meant I lost the ability to view all when the field is null. Which I need.

    So in summary I need a query criteria that displays the results of the searchbar as they appear exactly
    And display all the results if the searchbar is null



    Please can anyone help

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    GenestealerUK is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2013
    Posts
    2

    Yes... Solved

    Thank you. So simple, I should have thought of it myself.

    Outstanding


  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Populate Field when result is Null
    By BarneyH4 in forum Queries
    Replies: 3
    Last Post: 06-25-2013, 11:03 AM
  2. Replies: 3
    Last Post: 05-02-2013, 10:36 AM
  3. Display custom error if field is null or zero
    By steve87bg in forum Access
    Replies: 1
    Last Post: 01-14-2013, 02:33 AM
  4. Replies: 8
    Last Post: 03-18-2012, 11:17 AM
  5. Replies: 1
    Last Post: 02-23-2012, 02:27 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