Results 1 to 4 of 4
  1. #1
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451

    Query for multiple values to display "All"

    I have a field for location ID in my temporary table, this is a numeric value based on the location of the location that entered the record. Most times this temporary table will be based on a single location but on occasion it will be based on all locations. My form that queries the reports that are based on this temporary table displays the parameters of the temporary table in text boxes and is based on a query. Currently the form displays items like the start and end date of the loaded record set in the temporary table. I would like to add another text box to my form for the loaded location in the temporary table but how do I query so that if there are multiple location ID's to display "All Locations"?

  2. #2
    nrgins's Avatar
    nrgins is offline some guy
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    62
    Add a text box for the user to enter the location ID. Make * the default value of the text box.

    Then, in your query's Criteria row, under Location ID, use the Like keyword to reference the text box, e.g.:

    Code:
    Like Forms!MyForm!MyTextbox
    where MyForm and MyTextbox are the names of your form and textbox.

    That will return records for all locations if the value of the textbox is *.

  3. #3
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    Thanks, but I'm not trying to query all. I'm looking for a way to distinguish if there is more than 1 location in the forms recordsource query to display "All Locations". If the forms query finds that there is more than one location ID in the field then return "All Locations".

  4. #4
    nrgins's Avatar
    nrgins is offline some guy
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    62
    In that case, you'll have to provide more information about how your data is stored. A screen shot of the table where locations are stored in design view would be helpful. Or at least the field name and type where locations are stored. Is this a single value field with multiple records; a multi-value field; etc? Without knowing how your data is stored, not much I can do to help.

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

Similar Threads

  1. Replies: 9
    Last Post: 02-02-2016, 06:27 AM
  2. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  3. Replies: 1
    Last Post: 02-05-2015, 05:41 PM
  4. Replies: 5
    Last Post: 03-22-2013, 01:11 PM
  5. a simple "display date " query
    By Ushera in forum Queries
    Replies: 2
    Last Post: 07-31-2009, 06:49 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