Results 1 to 2 of 2
  1. #1
    fredalina is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    1

    Creating a table with multiple records parsed out of a single long string of data

    Hi, I was given a table that has a long string that consists of "chunks" of items of data separated by a semicolon. For example: [1111-AA-222; 1112-AB-333; 1113-BB-999]. I need to create a table or query that contains one of the other fields (Project number) and then one row for each "chunk" of data in the long string. So the table would look like this:

    ProjectNumber / Item
    12345 / 1111-AA-222


    12345 / 1112-AB-333
    12345 / 1113-BB-999
    98765 / 2222-ZZ-999
    98765 / 2224-YY-888

    I have no problem creating the code to parse the Items out of the long string and into an array. The problem is I don't know how to get it into a table (or query) once I do.

    Can you help?

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Use an append query to insert the data into the proper table.
    Something like (Air code):
    Code:
    sSQL = "INSERT INTO MyTable (ProjectNumber, Item) VALUES (" & pProjectNum & ", '" & pItem & "';)"
    CurrentdB.Execute sSQL, dbfailonerror
    "ProjectNumber" would probably be a FK field.

    Would have to see your code and/or know more about your dB to give a better answer.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-16-2013, 04:35 PM
  2. Replies: 8
    Last Post: 04-18-2013, 04:41 PM
  3. Replies: 3
    Last Post: 11-16-2011, 11:53 AM
  4. Creating multiple records from a single form
    By secretary in forum Forms
    Replies: 8
    Last Post: 07-18-2011, 04:03 PM
  5. Creating a string from all records in a table
    By ocordero in forum Programming
    Replies: 2
    Last Post: 08-07-2006, 09:21 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