Re: Trimming a telephone number....Or replacing
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Wed, 21 Mar 2007 15:32:20 -0600
buckpeace wrote:
I need to either trim or replace this number: (386)851-0090
to look like: 3868510090 (no dashes or ())
If that the only cases you have to deal with:
Replace(Replace(Replace(phone, "(", ""), ")", ""), "-", "")
If it gets much more complicated than that, you should
probably create a function to keep only digits:
Public Function ExtractDigits(s)
Dim k As Integer
If IsNull(s) Then Exit Function
For k = 1 to Len(s)
If Mid(s, k, 1) Like "#" Then
ExtractDigits = ExtractDigits & Mid(s, k, 1)
End If
Next k
End Function
--
Marsh
MVP [MS Access]
.
- Prev by Date: Re: Pivot question
- Next by Date: Re: Move Values to Fields in Query?
- Previous by thread: Re: Trimming a telephone number....Or replacing
- Next by thread: Not sure of the official name
- Index(es):