Stripping out spaces from a string

CharlesWhiteman

Registered User.
Local time
Today, 09:47
Joined
Feb 26, 2007
Messages
421
My Db records mobile telephone numbers and provided users enter the number without any spaces i can use the following to put it into international format, which I need to do as the number also gets used for sms messaging.

If 255 - Len(Trim(Me.txtMessage)) < 1 Then
KeyCode = 8
End If

so thats the code i'm using to strip of the preceeding 0 and then i replace the 0 with a +44 automatically.

does anyone know (not much on the posts on it) so that a user can put a number in typically something like 07123 123 456 or they may type 07123 123456

Slo its how to remove all the spaces. (I have another field which stores the modified value).
 
Well with a bit of patience have found the answer so here it is.

Code:
Dim strRemSpaces As String
strRemSpaces = Replace(Replace(txtMobile, " ", ""), "-", "")
Me.smsNotifyNumber = "+44" & (Right$(strRemSpaces, 10))
 
You never mentioned the "-", we can only work with what we are given

Brian
 

Users who are viewing this thread

Back
Top Bottom