Input Mask question

  • Thread starter Michael Johnston
  • Start date
M

Michael Johnston

I'm just learning Access on my own, and something has me puzzled about
masks.

If I want the ZIP code field to show as either
12345 or
12345-6789 depending on whether the user enters
5 or 9 characters

I get a display of
12345- when only 5 characters are entered.

The mask I'm using is 00000\-9999;;" " and it works fine except that the
5-character ZIPs look funny with that trailing hyphen. The hyphen should
show only when a 9-character ZIP is used.

How do you suppress the "-" for 5 digit ZIPs? And BTW, I'm not really
interested in using 2 fields for each part, but if that's the only way,
I will.

Cheers!
Michael
 
J

Jackie L

Michael,
Why not just remove the input mask and have the "-" entered manually?
 
M

Michael Johnston

Jackie said:
Michael,
Why not just remove the input mask and have the "-" entered manually?

Because it's an extra character that can be omitted or entered
incorrectly by the user: Some 12345-6789 and some 123456789 and some
12345=6789. You could control it with Len() but then you'd have to check
that "-" was there and then the users would complain that they have to
type "-" when other programs don't want it or won't allow it and so on.

Besides, it's just the kind of thing a database should do. <g>

Cheers!
Michael
 

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