How can I remove unwanted characters from a field. I know that TRIM (left/right) will remove spaces. Is there a function to remove unwanted characters wheather it be from front, back or middle?
Well you could try something like this. You could call it from a query and enter the FieldName for the strValue arugment.
Function cleanString(strValue as String)
Dim i as Integer
Dim strHolder as String
For i = 1 To Len(strValue)
If Mid(strValue,i,1)<> " " 'for a space or Chr(34) for " or whatever value you don't want
strHolder = strHolder & Mid(strValue,i,1)
Else
End If
Next
I thought about the Replace function but with Replace I had to define the values I wanted to get remove. That was a little messier than I wanted to get, I was looking for quick and dirty.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.