Question : What is the easiest way to filter out all non-printable characters from a string?

Access 2003, VBA

What is the easiest way to filter out all non-printable characters from a string?

Todd

Answer : What is the easiest way to filter out all non-printable characters from a string?

you will need a function to that

place this function in a module

Function CleanString(sString As String) As String

    Dim sReturn As String, i
    sReturn = ""
    For i = 1 To Len(sString)
       If (Asc(mid(sString, i, 1)) >= 32 And Asc(mid(sString, i, 1)) <= 127) Then
           sReturn = sReturn & Chr(Asc(mid(sString, i, 1)))
       
       End If
    Next i
    CleanString = Trim(sReturn)
   
End Function


just modify the range  32 and 127


Random Solutions  
 
programming4us programming4us