Q
Qslx
Variables, values and strings, and loops - NEWBIE
I'm trying to clean all trailing character codes from 0 to
127 (except 48 to 57) from the beginning and ending of each
record from field1 and tableA.
I've managed to clean the first occurence from beginning
and end of each record.
For the remaining ones (in the next positions) I've tried a
do/loop statement including the first one, such as (for
beginning of the field):
Public Function clean (field1 As Variant)
Dim fullText As Variant
fullText = Trim(field1)
Dim caracter1 As Variant
'Dim caracter2 As Variant
Dim restoTexto As Variant
caracter1 = Left(fullText, 1)
'caracter2 = Right(fullText, 1)
Dim nrAscii As Integer
nrAscii = Asc(caracter1)
Do while nrAscii < 48
Select Case nrAscii
Case 0 To 47
clean = Trim(Replace(Left(fullText,1), caracter1, "") &
Mid(fullText, 2))
loop
End Select
The system then stops working.
I appreciate any help.
Thanks.
I'm trying to clean all trailing character codes from 0 to
127 (except 48 to 57) from the beginning and ending of each
record from field1 and tableA.
I've managed to clean the first occurence from beginning
and end of each record.
For the remaining ones (in the next positions) I've tried a
do/loop statement including the first one, such as (for
beginning of the field):
Public Function clean (field1 As Variant)
Dim fullText As Variant
fullText = Trim(field1)
Dim caracter1 As Variant
'Dim caracter2 As Variant
Dim restoTexto As Variant
caracter1 = Left(fullText, 1)
'caracter2 = Right(fullText, 1)
Dim nrAscii As Integer
nrAscii = Asc(caracter1)
Do while nrAscii < 48
Select Case nrAscii
Case 0 To 47
clean = Trim(Replace(Left(fullText,1), caracter1, "") &
Mid(fullText, 2))
loop
End Select
The system then stops working.
I appreciate any help.
Thanks.