Well, you can setup text boxes on forms to ONLY allow numbers with a input
mask.
However, if you have existing data that you need to fix, then you can use:
Public Function OnlyNumbers(myphone As String) As String
Dim i As Integer
Dim mych As String
OnlyNumbers = ""
If IsNull(myphone) = False Then
For i = 1 To Len(myphone)
mych = Mid$(myphone, i, 1)
If InStr("0123456789", mych) > 0 Then
OnlyNumbers = OnlyNumbers & mych
End If
Next i
End If
End Function
The above function will strip all non alpha chars from a give string. You
can even do a update query on a column (make a backup before you attempt
this).
In the query buidler just type in:
update tblCustomers set FaxNum = OnlyNumbers([FaxNum]) where faxNum is not
null
-
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)