Is there anyway to strip all characters except numeric out of a value? For example: 999/777-5555. I want to strip the / and the hyphen. The characters can vary so is there anyway to recognize just numeric?
I'm sorry but could you be a little more specific? What text manipulation functions are you referring to? Is there a "numeric only" function? I know of the InStr, Left,Mid, and Right functions but those aren't going to get the job done.
You would need to write your own function using the Mid, Left or other text manipulation functions.
Something Like
Code:
Function CleanString(ByVal tmpSTR As String) As String
Dim i As Long
For i = 1 To Len(tmpSTR)
If IsNumeric(Mid$(tmpSTR, i, 1)) Then
CleanString = CleanString & Mid$(tmpSTR, i, 1)
End If
Next i
End Function
It didn' t work for me. The field is in a table of 6000 records where the phone number is keyed in so many different ways. Ex:999/999-9999 or 999.999.9999 or 9999999 . I just need to get it to display nothing but the numeric characters. I was hoping there was an easier function to run that would pull out only the numeric characters. I tried the Val function but it returns the numbers up to the unrecognizable character.
I don't quite understand how you are passing the field's value to tmpStr. I understand the For Next statement and the IsNumeric statement. But how are you getting the data passed to the variable?