Results 1 to 3 of 3
  1. #1
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172

    function to strip characters

    Hi,



    I have a field containing:

    CCC1/1234/1
    CCC1/123/12
    CCC1/5678/56
    CCC1/678/3

    I need a way to strip the numbers out between / and /.

    There could be either 3 or 4 characters after the first / (these are the ones I want), and there could be 1 or 2 characters after the 2nd /.

    I can strip the CCC1/ easily because it is always the same, but having trouble figuring out how to strip the characters after the / on the right.

    Any help much appreciated

    Kirsti

  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,642
    You can use the InStrRev() function to find the position of the last /. That with the Mid() the Len() functions and some creative math should provide your result.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Kirsti is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Location
    New Zealand
    Posts
    172
    Thanks Paul.

    Got it working using:

    IIf([Field1] Is Null,Null,(Mid([Field2],6,(InStr(6,[Field2],"/"))-6)*1))

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

Similar Threads

  1. Strip input mask in query results?
    By Stan Denman in forum Queries
    Replies: 1
    Last Post: 06-05-2012, 02:16 PM
  2. How to count characters?
    By Jorge Junior in forum Access
    Replies: 1
    Last Post: 05-22-2011, 08:07 PM
  3. erase characters at the end
    By bjelinski in forum Access
    Replies: 14
    Last Post: 07-05-2010, 12:03 PM
  4. Replies: 1
    Last Post: 03-18-2010, 09:12 AM
  5. Special Characters
    By orgelizer in forum Access
    Replies: 0
    Last Post: 03-20-2007, 08:24 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