Results 1 to 4 of 4

Thread: Sample DB : Search Multiple Data Separated by Comma

  1. #1
    spideynok is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    48

    Sample DB : Search Multiple Data Separated by Comma

    Hi there before I had a problem with multiple search like this, using a keyword and can be separated by comma. Just now I would like to share my code and database for you all and for all the newbie like me that looking for this kind of project. I hope this will help you too.

    NOTE : Search multiple using comma.. DO NOT put space after comma you may search like this : [1,3] and not like this [1, 3].
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    24,435
    Or don't rely on user to not use space and use Trim function to make sure leading spaces, if any, are dropped.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

  3. #3
    spideynok is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    48
    Oh sorry sir. I just edited the code after I post this and can use space after comma, so it doesn't make them confuse.

    just change this code :
    Code:
    strFilters = Split(Nz(.Text47, ""), ",")
    into this :
    Code:
    strFilters = Split(Nz(.Text47, ""), ", ")
    NOTE : I just put space on it. Just look at the difference


    BTW this project was made with the help of Sir June7

  4. #4
    June7's Avatar
    June7 is online now Moderator
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    24,435
    And what if the user does not include space (intentionally or not), the delimiter in the Split won't match. Safer to use only comma as delimiter and Trim function on the array elements.
    To provide db: Make copy, remove confidential data, run compact & repair, zip if large - 2mb allowed, attach to post. Attachment Manager is below the Advanced post editor window.
    If suggestion in this post resolves your issue, please use the Thread Tools and mark the thread as Solved!

    Debug!Debug!Debug! http://www.cpearson.com/excel/debug.htm

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

Similar Threads

  1. Replies: 12
    Last Post: 03-22-2012, 01:48 AM
  2. Replies: 6
    Last Post: 06-25-2011, 11:15 PM
  3. Replies: 2
    Last Post: 04-07-2011, 09:15 AM
  4. Interesting Query Problem (Sample Data Provided)
    By pinecrest515 in forum Queries
    Replies: 1
    Last Post: 02-07-2011, 01:27 PM
  5. Replies: 1
    Last Post: 07-31-2009, 02:57 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums