shank said:
Is there a way to convert a text string into ASCII characters automatically?
Like "hi !" = Chr(104) & Chr(105) & Chr(32) & Chr(33)
I have a string with invisible characters that I have not had any luck
removing with a query.
thanks!
Hi shank,
Here be a function that I have used
that may come close to what Allen
has suggested. It separates each ascii
value with a hyphen.
'*** start code ****
Public Function fGetAsc(pString As Variant) As String
On Error GoTo Err_fGetAsc
Dim i As Integer
If Len(Trim(pString & "")) > 0 Then
For i = 1 To Len(pString)
fGetAsc = fGetAsc & Asc(Mid(pString, i)) & "-"
Next
fGetAsc = Left(fGetAsc, Len(fGetAsc) - 1)
Else
fGetAsc = "Null or ZLS"
End If
Exit_fGetAsc:
Exit Function
Err_fGetAsc:
MsgBox Err.Description
Resume Exit_fGetAsc
End Function
'*** end code ***
Save it in a module (your module must have a
different name than this function).
Then you can use in query
SELECT fGetAsc([yourfield]) As AscEquiv, ..
FROM yourtable;
Please respond back if I was not clear
about something.
Good luck,
Gary Walter