Results 1 to 6 of 6
  1. #1
    okinawan79 is offline Novice
    Windows XP Access 2016
    Join Date
    Aug 2018
    Posts
    5

    Extract Portion of Text Strings into separate columns

    Hi Everyone,



    I have below texts in one cell (column)

    Descriptions:
    abcedfgeljkfjldsjflkjf

    Pre-Conditions:
    akjdfljdskfsjdl


    Post-Conditions:
    kjljkjk

    Next Test(s):
    sdfdsfds



    I want to extract Pre-Conditions and Post-Conditions on to a separate columns using query design...

    help!
    Thank you

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    Show example real data.

    What is actual data structure? Is there consistency in length of each part or separated by space or character?
    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
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,724
    Welcome.
    You may know what the question means, but readers do not.
    I suggest you try again with real data and clearly show the before and after data.
    Clarity is key to asking a question and getting a focused response.

  4. #4
    okinawan79 is offline Novice
    Windows XP Access 2016
    Join Date
    Aug 2018
    Posts
    5
    Click image for larger version. 

Name:	screenshot.jpg 
Views:	8 
Size:	243.3 KB 
ID:	35190

    I have attached the screenshot from what it look like in Excel. Once imported into Access, I would like

    "Pre-Conditions: 1. Cash Receipt is Created in CSA " in new column and

    "Post-Conditions: 8300 tables are updated with the information edited in this case" in new column
    for 1st row

    Click image for larger version. 

Name:	DESIRED RESULT.jpg 
Views:	8 
Size:	96.9 KB 
ID:	35191

  5. #5
    okinawan79 is offline Novice
    Windows XP Access 2016
    Join Date
    Aug 2018
    Posts
    5
    Quote Originally Posted by June7 View Post
    Show example real data.

    What is actual data structure? Is there consistency in length of each part or separated by space or character?
    Posted the reply with picture... hope this helps.

    Thanks again for your help

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    Consistency of structure is critical when parsing strings. Let x represent the TS_DESCRIPTION field and consider:

    Mid(x, Instr(x,"Descriptions:"), Instr(x,"Pre-")-3)

    Mid(x, Instr(x,"Pre-Conditions:"), Instr(x,"Post-")-Instr(x,"Pre-Conditions:")-2)

    Mid(x, Instr(x,"Post-Conditions:"), Instr(x,"NextTest(s):")-Instr(x,"Post-Conditions:")-2)

    Mid(x, Instr(x,"NextTest(s):"))

    If this doesn't satisfy requirement, likely have to do a VBA custom function.
    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: 7
    Last Post: 01-21-2016, 08:59 PM
  2. how to extract strings in a query
    By amai in forum Tutorials
    Replies: 4
    Last Post: 11-21-2015, 05:33 AM
  3. Replies: 10
    Last Post: 05-22-2013, 02:56 PM
  4. Replies: 1
    Last Post: 05-15-2013, 01:24 PM
  5. Replies: 61
    Last Post: 03-14-2011, 03:29 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