Results 1 to 4 of 4
  1. #1
    BLFOSTER is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2013
    Posts
    68

    Parameter Query using Like with Leave Blank to See All

    Hi I am sure this is simple, but I cannot figure it out. In my query grid: Field Name is "Activity". I want the user to be able to type a part of the Activity name when prompted, so as criteria I am using this: Like "*" & [Enter any part of Activity to search by, Leave Blank to See All: ] & "*"

    Now I want the user to Leave Blank to See All: Expr1: Like "*" & [Enter any part of Activity to search by, Leave Blank to See All: ] & "*" Criteria under Expr1: Is Null or Is Not Null.

    The Query tells me my Expr1: has invalid syntax and highlights the word "Like".

    How can I make this do what I want?

    Thanks so much!


    Becky

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,737
    Remove that criteria and try again.

    example sql

    SELECT AnimalsAndLocations.AName, AnimalsAndLocations.SightingDate, AnimalsAndLocations.GPSLat
    FROM AnimalsAndLocations
    WHERE (((AnimalsAndLocations.AName) Like "*" & [enter something or leave blank for all] & "*"));

  3. #3
    BLFOSTER is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2013
    Posts
    68
    Perfect! Thank you!

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,737

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

Similar Threads

  1. Replies: 4
    Last Post: 12-18-2013, 12:27 PM
  2. Replies: 42
    Last Post: 11-27-2013, 08:55 PM
  3. View all data for blank parameter entry
    By royalrochelle in forum Queries
    Replies: 3
    Last Post: 09-07-2011, 08:00 PM
  4. Display all results if parameter is blank
    By justifiedcandy in forum Queries
    Replies: 2
    Last Post: 09-02-2010, 03:00 PM
  5. help need on query report on who is on leave
    By islandboy in forum Forms
    Replies: 10
    Last Post: 08-17-2009, 12:13 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