Zip code code

T

TeeSee

Could someone please tell me why this doesn't work. I swear it did
when I first installed it from an old post within this group ..... but
today it doesn't.
Sub CheckMailCodeFormat(strZip)
dim strZip as String
Select Case Len(strZip)
Case 7
'Canadian postal code (with space)
If strZip Like "@#@ #@#" Then ' There is one space in the
middle of the like string
Me.txtZipCode.Value = UCase(strZip)
Else
MsgBox "'" & strZip & "' is not a valid US or Canadian
postal code."
Me.txtZipCode.Value = Null
End If
end select
end sub
As I step through the sub the inputed string shows correctly as for
instance "n7s 3t9"
If I enter the input string without the space CASE6 catches and
properly formats it.

It is probably staring me right in the face but I can't see it.

Thanks as always
 
T

TeeSee

Could someone please tell me why this doesn't work. I swear it did
when I first installed it from an old post within this group ..... but
today it doesn't.
Sub CheckMailCodeFormat(strZip)
dim strZip as String
Select Case Len(strZip)
Case 7
        'Canadian postal code (with space)
        If strZip Like "@#@ #@#" Then   ' There is one space inthe
middle of the like string
            Me.txtZipCode.Value = UCase(strZip)
        Else
            MsgBox "'" & strZip & "' is not a valid US or Canadian
postal code."
            Me.txtZipCode.Value = Null
        End If
end select
end sub
As I step through the sub the inputed string shows correctly as for
instance "n7s 3t9"
If I enter the input string without the space CASE6 catches and
properly formats it.

It is probably staring me right in the face but I can't see it.

Thanks as always

Don't bother ... I think I solved it "?#? #?#"
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top