Results 1 to 4 of 4
  1. #1
    razkowski is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    16

    How to split a row into multiple rows

    Hello-



    I'm trying to determine if it's possible to split 1 row into multiple rows based on a field value. Please see the attached spreadsheet. Please be forewarned, I'm no good in SQL. If you have any answer for this, please provide it in VBA or in a query design view.

    Thank you
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,944
    Depends on the data in Field11. Is the data structure consistent? Will there ALWAYS be two 2-digit numbers with 'and' between them? If yes, I suggest a UNION query is simplest.

    SELECT *, Left(Field11,2) AS Data FROM tablename
    UN ION SELECT *, Right(Field11,2) FROM tablename;

    There is no query builder or wizard for UNION, must type into SQL View of query designer.

    Otherwise, will probably involve VBA writing records to a table.
    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.

  3. #3
    razkowski is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2012
    Posts
    16
    No, the data structure will change. Sometimes the 2 numbers are separated by "and", sometimes "&", sometimes "/" etc. This is vendor provided data and I cannot change that. The data will always start with a 2 digit number and end with a 2 digit number, that's the only thing I can count on.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,944
    Okay, my suggestion doesn't really care what falls in the middle, as long as each record has a value with the 2-digit numbers on each side, should work.
    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. Replies: 4
    Last Post: 04-29-2014, 04:33 AM
  2. Split one row records to several rows
    By harpreett.singhh@gmail.co in forum Access
    Replies: 1
    Last Post: 03-19-2014, 12:41 PM
  3. Split form auto resize rows and columns
    By data808 in forum Forms
    Replies: 3
    Last Post: 03-13-2014, 03:26 AM
  4. Replies: 1
    Last Post: 07-01-2013, 08:21 AM
  5. split column into rows.
    By rsampathy in forum Access
    Replies: 1
    Last Post: 03-03-2011, 12:15 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