Applecore Pages on Microsoft Access

Replacing characters within a string

If you want to replace characters within a string, then you will need some code similar to that below.

Function fReplaceCharacters(ByVal strIn As String, strCharToReplace As String, strCharReplaceWith As String) As String
    If InStr(1, strIn, strCharToReplace) > 0 Then
        Do Until InStr(1, strIn, strCharToReplace) = 0
            strIn = Left(strIn, InStr(1, strIn, strCharToReplace) - 1) & strCharReplaceWith & Mid(strIn, InStr(1, strIn, strCharToReplace) + Len(strCharToReplace))
        Loop
    End If
    fReplaceCharacters = strIn
End Function

Top

 


HOME | NEW | TABLES | QUERIES | FORMS | REPORTS | GENERAL | API | DOWNLOADS | TUTORIAL | RESOURCES
E-MAIL
Copyright & Disclaimer

 

Last modified at 06/06/2006 14:54:30