Results 1 to 5 of 5
  1. #1
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49

    replace multiple characters

    Hello friends!

    in this sample I want replacing all characters (28 case) in the Textbox by this rules.

    A = AB1


    B = BC2
    C = CD3
    D = DE4
    ...

    for example :
    C A D = CD3 AB1 DE4


    I think we need a module . can anyone help ?
    Attached Files Attached Files

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    perhaps something like


    Code:
    function replaceChars(S as string) as string
    dim I as integer
    dim newStr as string
    
    for I=1 to len(s)
    Select case mid(s,i,1)
        case " "
           newstr=newStr & " "
        Case "A"
           newstr=newStr & "AB1"
       case "B"
           newstr=newstr & "BC2"
       case "C"
          …..
    end select
    
    replaceChars=newStr
    end function

  3. #3
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    yes something like this

    but .....

    Click image for larger version. 

Name:	222.jpg 
Views:	9 
Size:	99.1 KB 
ID:	35808

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    sorry, forgot the next I line, goes after the end select line

  5. #5
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    thanks dear Ajax


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

Similar Threads

  1. Replies: 4
    Last Post: 11-28-2017, 02:54 PM
  2. Replies: 11
    Last Post: 03-02-2017, 12:52 PM
  3. Using Replace() for special characters
    By RayMilhon in forum Programming
    Replies: 2
    Last Post: 01-07-2017, 02:44 PM
  4. Replies: 3
    Last Post: 06-07-2012, 07:05 AM
  5. replace characters in a string
    By blazixinfo@yahoo.com in forum Access
    Replies: 6
    Last Post: 08-06-2009, 03:36 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