Results 1 to 8 of 8
  1. #1
    MrBologna is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    48

    Multi-input search query

    Hello!



    I have a database that is full of parts and their data (part number, manufacturer, manufacturer part number, description, price)
    And I need to create a form/query that filters them based on inputs on the form.

    I have already created one of such combos, and it works well because it was standard and easy to do.

    This one, however, is mainly used for comparisons.
    I need to be able to look up multiple distinct part numbers, or a manufacturer, or a specific part type.

    For example, rely100 and rely128 are both relay parts, and should come up along with all other RELY parts when I type RELY into one of the part number fields.
    But if I type rely100 into one search field and rely128 into another, I want them both to come up so that I can compare the two.
    Basically, I want everything to be an "or" statement.

    The issue I'm having is that with the format I used for partial searches before (Like "*" & [Forms]![Parts_Search_Form]![Input_MFG] & "*")
    will always return all parts if used in an or statement.

    Is there something that allows for ambiguous input without returning all values? Like a "contains" statement?

    Any help is greatly appreciated, thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Review http://allenbrowne.com/ser-62.html

    What do you mean by 'one of the part number fields' - there is more than one? Why?
    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
    MrBologna is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    48
    Yes, my initial idea was to use multiple input fields for part numbers to compare them, but inputting multiple separated by commas or something would work as well.

    The user needs to be able to pull up more than one part at a time, with just the part number.

  4. #4
    MrBologna is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    48
    The results should look something like this, when using the three search criteria in green
    Click image for larger version. 

Name:	Capture.PNG 
Views:	19 
Size:	20.5 KB 
ID:	35411

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    you could have a text box where the user enters part number separated by a comma, then your filter would be something like

    me.filter="[PartNo] IN (" & txtMultiParts & ")"

  6. #6
    MrBologna is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    48
    My apologies, but I am quite new to Access. How exactly would I format that?

    I tried putting this in the query criteria for the part number:
    In ([Forms]![Parts_Search_Form]![Input_PartNo1])

    And it only works if I type in 1 exact part number, like RELY300. It does not work for any of the following:
    RELY
    "RELY"
    RELY128, RELY300
    "RELY128, RELY300"

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    My question was concerning table design. You have only one part number field? Multiple input controls is different. Probably when you said fields you really meant textboxes.

    To use one textbox for input, user would have to enter text values with apostrophe delimiters around each value (if field is text type) as well as separating with comma. Do you really think users will appreciate this? How many might user want to select at one time?

    Dynamic parameter array for IN() can't be in query. Must use VBA to set form Filter property.
    Last edited by June7; 09-07-2018 at 05:44 PM.
    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.

  8. #8
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,845
    thought you were using a filter, not a criteria. not sure how you would use it in a query

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

Similar Threads

  1. Multi Search Criteria Form/Query
    By NickWren in forum Access
    Replies: 4
    Last Post: 10-04-2016, 05:42 PM
  2. Replies: 15
    Last Post: 11-26-2015, 11:27 AM
  3. Replies: 1
    Last Post: 10-29-2014, 10:23 AM
  4. Multi-Field Search issues within Query
    By stiracerdude in forum Queries
    Replies: 3
    Last Post: 10-14-2012, 01:04 PM
  5. Multi-Field Search Query not working
    By omair1051992 in forum Queries
    Replies: 16
    Last Post: 06-19-2012, 05:46 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