Results 1 to 4 of 4
  1. #1
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    305

    Split Comma Delimited Field to Rows in a query

    So I have a database table with a comma delimited field that I need to split into multiple rows. See below example:

    ID Text
    1 Peter
    2 Peter, George
    3 Mike, Kelly, Jim, Jim, Jim


    I need it to look like this:
    1 Peter
    2 Peter
    2 George
    3 Mike
    3 Kelly
    3 Jim
    3 Jim
    3 Jim


    Any recommendations on how to do this? Any guide I have found online is hidden behind a paywall

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    You could use Split function to divide the elements into an array, then loop through the array and update a recordset. Must be free code examples for that. What did you search for? This ms access vba split string into recordset
    produced 89 results with lots of sub-results
    post 6 here is just one solution
    https://www.access-programmers.co.uk...ecords.242856/
    also post 2 here
    https://stackoverflow.com/questions/...s-in-access-db
    and so on.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    305
    Thanks for the links. I must not have been searching the right terms, but granted, I didn't really know what to be looking for. This was one I found for instance: https://www.experts-exchange.com/que...d-to-Rows.html

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Not sure how many here have a subscription to that site - not me anyway, so no way to view any solutions.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 3
    Last Post: 08-24-2017, 10:04 PM
  2. Replies: 14
    Last Post: 03-01-2012, 02:39 PM
  3. Comma Delimited List Query/Report
    By scrapyard in forum Queries
    Replies: 3
    Last Post: 01-20-2012, 07:06 AM
  4. create comma delimited string from column in query
    By younggunnaz69 in forum Queries
    Replies: 2
    Last Post: 04-30-2011, 04:26 PM
  5. Parsing A Comma Delimited Field
    By AccessGeek in forum Import/Export Data
    Replies: 6
    Last Post: 02-03-2011, 01:52 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