Results 1 to 2 of 2
  1. #1
    DB4284 is offline Novice
    Windows Vista Access 2000
    Join Date
    Nov 2010
    Posts
    1

    Split string when specific word is found


    I want to extract a value from a string eg

    teststring - teststring2 [01022] teststring3 [082382] keyword [1234]

    I want to be able to find the "keyword" value in the string and then extract the value "1234" from the string. I have been looking at various functions and im thinking that a split function is required.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You could use the Split() function. You'd step through the resulting array until you found the keyword, then grab the next value.

    If you wanted a non-VBA solution, you could also use a combination of InStr() to find the position of the keyword, another to find the position of the first "[" after that, another to find the position of the "]" after it, and the Mid() function using those two values.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. get a specific data in a string
    By dada in forum Programming
    Replies: 2
    Last Post: 09-21-2010, 01:20 AM
  2. If Not Found, then New?
    By gracysaurus in forum Programming
    Replies: 1
    Last Post: 08-17-2010, 04:58 PM
  3. Split a string for use as query parameters.
    By Hobbes29 in forum Forms
    Replies: 3
    Last Post: 06-27-2010, 04:39 PM
  4. Split string into Date and Time Columns?
    By Hobbes29 in forum Queries
    Replies: 2
    Last Post: 06-08-2010, 06:50 PM
  5. Query not found, but it is there
    By Gdm in forum Queries
    Replies: 5
    Last Post: 05-21-2010, 05:59 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