Results 1 to 4 of 4
  1. #1
    bchi99 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    23

    Extract string before and after a period

    Hello, i need help selecting a string of characters before and after a period.

    Sample string is:

    hello world 12345.1234 hello earth

    I would like the expression to return: 12345.1234



    Thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You should become familiar with all the string manipulation functions and how to use them. Once the functions are understood, just a matter of determining the consistencies that can be depended on and applying logic. The examples given in your other thread should have been a good introductory primer.

    There is only the one period? Always the same number of digits?

    Mid(x, InStr(x, ".")-5, 10)
    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
    bchi99 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    23
    Thanks that works. Yes its just very confusing to me. I'm just starting out.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Practice, practice, practice!

    Learn how to use the VBA Immediate Window to test expressions. That's where I verified the suggested expressions I posted. It looks like:

    x="hello world 12345.1234 hello earth"
    ?Mid(x, InStr(x, ".")-5, 10)
    12345.1234
    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. Extract part of string
    By Fais in forum Access
    Replies: 5
    Last Post: 08-06-2014, 04:46 PM
  2. Replies: 3
    Last Post: 12-04-2012, 05:22 PM
  3. Replies: 8
    Last Post: 11-08-2012, 07:08 AM
  4. Extract Value from Variable in String
    By nguyenak in forum Programming
    Replies: 3
    Last Post: 05-24-2012, 03:50 PM
  5. Extract String From Between 2 Values
    By kathleencampbell in forum Queries
    Replies: 5
    Last Post: 03-23-2012, 10:52 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