Results 1 to 2 of 2
  1. #1
    gustavoavila is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    6

    Multiline textbox query search

    Hi folks,
    First of all, I'm very happy to enter in this community. I'm pretty sure that I will find a lot of knowledge and I will try to help everytime I can.

    This is my case:

    For weird reasons, in my new job, the business rule is use Excel and Access only solutions. I have some expertise working with some DBMS like MySQL/MSSQL and developing webforms in PHP. The point here is, I'm "forced" to work with forms in access. The problem here is: I don't have any expertise working with Access.

    So, I'm trying to create a simple form to search multiple values in one textbox. I want to paste the values in the textbox (every row contains a single record), and display the query result. I don't have any problem to show the query results, but I'm stuck to make that Access read every single row to find every record.

    Ex:

    [textbox data]
    Record1
    Record2
    Record3
    Record4
    ....


    Query:

    Code:
    SELECT Classifications.WisperPlantID, Classifications.ClassificationCountry, Classifications.PartNo, Classifications.PartNoDescription, Classifications.ClassificationCode, Classifications.COEProject, Classifications.BU, Classifications.CreatedBy
    FROM Classifications
    WHERE (((Classifications.PartNo) like "*" & [Forms]![Search]![Text0] & "*"));


    If I run with 2 or more record in the textbox, the query returns no results, but If there is only 1 record in the textbox the query runs like a charm.

    Do you have any idea how to do multisearch with 1 textbox?


    Thanks in advance for your help.



    Cheers!!!!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    That WHERE clause won't work, this one might:

    WHERE InStr([Forms]![Search]![Text0], [PartNo])>0;

    Here is example of code to construct a multi-value criteria http://allenbrowne.com/ser-50.html

    The code constructs a comma-separated string and applies it to the WHERE CONDITION argument of OpenReport action using the IN operator.
    Last edited by June7; 02-10-2014 at 05:19 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.

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

Similar Threads

  1. Entering Data into Textbox as Search Criteria
    By Moonman in forum Programming
    Replies: 1
    Last Post: 12-16-2013, 06:11 PM
  2. Replies: 4
    Last Post: 05-17-2013, 02:38 AM
  3. Replies: 12
    Last Post: 06-08-2012, 02:37 AM
  4. Search and Find Records Textbox
    By accessissue in forum Programming
    Replies: 2
    Last Post: 04-13-2012, 06:16 PM
  5. Instant Search with textbox in Form
    By MrBeardo in forum Queries
    Replies: 1
    Last Post: 03-28-2012, 02:08 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