Results 1 to 2 of 2
  1. #1
    scubaman63 is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    1

    INSTR Help

    I have a field which contains data separated by commas and I would like to pull the first three data elements and disregard the rest. For example:

    The field contains Mike, John, Susan, James, Michael, James, Carol.

    I would like to pull Mike, John and Susan placing them in there own fields. I am using Access 2016 and I have tried using the Instr command, but was only able to pull the first and second data elements.

    Thanks

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,973
    Ah, the dreaded multivalue field. I recommend you get rid of them throughout your database.
    Anyway whilst it could be done using Instr it will be messy.

    Instead use the Split function.
    For further info, see https://analystcave.com/vba-referenc...plit-function/

    However, be aware that Split cannot be used in a query. Use VBA instead
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. InStr Help
    By MTSPEER in forum Programming
    Replies: 18
    Last Post: 09-07-2017, 07:34 AM
  2. Replies: 2
    Last Post: 04-07-2016, 07:19 AM
  3. Left instr help
    By tmcrouse in forum Forms
    Replies: 2
    Last Post: 05-12-2015, 08:47 AM
  4. IIF with instr
    By yoili in forum Reports
    Replies: 2
    Last Post: 01-22-2013, 01:32 PM
  5. Using InStr() inside Mid()
    By urbi in forum Programming
    Replies: 12
    Last Post: 06-06-2012, 12:00 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