Results 1 to 5 of 5
  1. #1
    Danelloc is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2023
    Posts
    16

    Parameter Query Multiple Fields using "OR"

    Is it possible to create a Parameter query to search multiple fields for the same term.

    For example:

    A decorator database captures color choice in a first, second, and third choice (3 separate fields). So "Green" could appear in any one of the three fields.


    I would like to create a query that can prompt the user to enter a color "[Enter color choice]" once that will search all three fields for the choice.

    I know I could do this by entering the parameter on each choice on a different criteria row in Design, but that would then prompt the user to enter the choice three times.



    Is there a cleaner way to do it?

    Is there a way to query "Choice1" OR "Choice2" OR "Choice3" using a single "[enter choice]"?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    know I could do this by entering the parameter on each choice on a different criteria row in Design, but that would then prompt the user to enter the choice three times.
    Are you sure about that?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    make a listbox for user to pick items (by dbl-clicking) to add to the t.Picked table.
    join this table to main data table to pull only those items.
    Attached Thumbnails Attached Thumbnails pick state lbls.png  

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    or cycle thru the list to create sql OR part:
    ssql = select * from table where [state] ='AZ or CA or FL'

  5. #5
    Danelloc is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2023
    Posts
    16
    Quote Originally Posted by Welshgasman View Post
    Are you sure about that?
    Well that's what I get for assuming! :-D

    You are correct. It did exactly what I was looking for and only prompted once.

    Thanks for you help!

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

Similar Threads

  1. Replies: 2
    Last Post: 03-02-2023, 09:25 AM
  2. Replies: 2
    Last Post: 01-15-2018, 02:03 PM
  3. Replies: 1
    Last Post: 07-21-2015, 03:38 PM
  4. Replies: 7
    Last Post: 02-10-2015, 01:33 PM
  5. Replies: 8
    Last Post: 07-15-2014, 05:56 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