Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL forum
Answered

set up a zip code mask for US and Canadian zip codes

Posted on by Microsoft Employee

Hi

We do business with companies in the US and Canada and would like to eliminate the data entry errors associated with miskeying zip codes. Since the zip code syntax is so different between the 2 countries is there a way in SL to look at the Country code and then set a mask fir the zip code?

Thank you

Tom D

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: set up a zip code mask for US and Canadian zip codes

    awesome! thanks Randall, I will give it a try

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: set up a zip code mask for US and Canadian zip codes

    A quick VB customization like this works for the basic changing of the Zip code mask:

    Private Sub ccountry_Chk(ChkStrg As String, retval As Integer)

       If Trim(ChkStrg) = "US" Then

           czip.Mask = "99999-9999"

       ElseIf (Trim(ChkStrg) = "CA") Then

           czip.Mask = "WWW WWW"

       Else

           czip.Mask = "XXXXXXXXXXX"

           End If

    End Sub

    The challenge will be finding all of the places that this code would need to be added. Also, the default layout has the country after the zip code, so the order of fields may need to be changed to make it flow better for the user.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: set up a zip code mask for US and Canadian zip codes

    Hi Carolyn

    I am still looking for a solution to this. I am not a coder but it looks like writing some custom code may be the only solution

    Tom

  • RE: set up a zip code mask for US and Canadian zip codes

    Hi TomD,

    I can test this for you unless you already have found an answer.  Let me know.  Thanks.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,773 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,513 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans