VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Format a Postcode...... 4 3 format

SCC  (9 Submissions)   Miscellaneous   VB 6.0   Unknown Difficulty   Mon 10th May 2004   Mon 8th February 2021

Format a Postcode...... 4 3 format

API Declarations



Function FormatPostcode(myOriginalPostcode As String)
'Need Some Code? Request it at www.SmokeCrack.co.uk
Dim myCount As Integer
myCount = 0
Do
myCount = myCount + 1
If InStr(1, myOriginalPostcode, " ") <> 0 Then
myOriginalPostcode = Left(myOriginalPostcode, InStr(myOriginalPostcode, " ") - 1) & Mid(myOriginalPostcode, InStr(1, myOriginalPostcode, " ") + 1, 100)
End If
Loop Until InStr(1, myOriginalPostcode, " ") = 0
'START CHECKING LENGTH OF POSTCODE

If Len(myOriginalPostcode) = 7 Then
myOriginalPostcode = Left(myOriginalPostcode, 4) & " " & Right(myOriginalPostcode, 3)
End If


If Len(myOriginalPostcode) = 6 Then
If IsNumeric(Mid(myOriginalPostcode, 2, 1)) = True Then
'B 40 0DP
myOriginalPostcode = Left(myOriginalPostcode, 1) & " " & Mid(myOriginalPostcode, 2, 2) & " " & Right(myOriginalPostcode, 3)
Else:
'BN 4 0DP
myOriginalPostcode = Left(myOriginalPostcode, 2) & " " & Mid(myOriginalPostcode, 3, 1) & " " & Right(myOriginalPostcode, 3)
End If
End If

Rate Format a Postcode...... 4 3 format (1(1 Vote))
Format a Postcode...... 4 3 format.bas

Format a Postcode...... 4 3 format Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters