Article ID: 155134
Article Last Modified on 1/19/2007
[FAX:<number>]
[FAX:12065551212]
Option Explicit
Function FaxNumFormat(FaxNum)
' If the fax number field is empty, return "Invalid Fax" and exit.
If IsNull(FaxNum) Then
FaxNumFormat = "Invalid Fax Number"
Exit Function
End If
Dim Counter As Integer
Dim NewString As String
' Strip out all characters except numbers.
For Counter = 1 To Len(FaxNum)
If IsNumeric(Mid(FaxNum, Counter, 1)) Then
NewString = NewString & Mid(FaxNum, Counter, 1)
End If
Next Counter
' If NewString is 10 digits long and the call is local, format the
' digits to the right of the area code.
If Len(NewString) = 10 And _
Left(NewString,3) = "<YourAreaCode>" Then
NewString = Right(NewString,7)
NewString = Format(NewString,"\[\F\A\X\:#\]")
' If NewString is 10 digits long, and the call is long distance, add
' the long distance prefix '1' to the beginning, then format
' accordingly.
ElseIf Len(NewString) = 10 Then
NewString = "1" & NewString
NewString = Format(NewString, "\[\F\A\X\:#\]")
' If NewString is 7 digits long, format accordingly.
ElseIf Len(NewString) = 7 Then
NewString = Format(NewString, "\[\F\A\X\:#\]")
Else
' All other numbers are invalid.
NewString = "Invalid Fax Number"
End If
FaxNumFormat = NewString
End Function
Field: CompanyName
Show: Yes
Field: ContactName
Show: Yes
Field: FaxNbr: FaxNumFormat([Fax])
Show: Yes
Criteria: <>"Invalid Fax Number"
CompanyName ContactName FaxNbr
------------------------- ------------- -----------------
Grandma Kelly's Homestead Regina Murphy [FAX:13135553349]
137160 How to Fax a Document Using File Send and Exchange
142344 Merging to Fax Unexpectedly Causes Exchange to Check Names
Keywords: kbhowto kbinterop kbprogramming KB155134