VB Code:
Private Sub CommandButton1_Click()
'6 combinations of valid postcodes AN, AAN, ANN, AANN, ANA, AANA
If Not Text1.Text Like "[A-Z][0-9] [A-Z][A-Z][A-Z]" Then
If Not Text1.Text Like "[A-Z][A-Z][0-9] [A-Z][A-Z][A-Z]" Then
If Not Text1.Text Like "[A-Z][0-9][0-9] [A-Z][A-Z][A-Z]" Then
If Not Text1.Text Like "[A-Z][A-Z][0-9][0-9] [A-Z][A-Z][A-Z]" Then
If Not Text1.Text Like "[A-Z][0-9][A-Z] [A-Z][A-Z][A-Z]" Then
If Not Text1.Text Like "[A-Z][A-Z][0-9][A-Z] [A-Z][A-Z][A-Z]" Then
Call MsgBox("Invalid Postcode, please re-enter.", vbExclamation, "Error")
Text1.SetFocus
Else
MsgBox "The Postcode you have entered is """ & Text1.Text & """"
Exit Sub
End If
End If
End If
End If
End If
End If
End Sub