input masks

  • Thread starter Thread starter Stacey
  • Start date Start date
S

Stacey

Hi everyone!

I have an ID variable defined as a text field. My users
want to have the ID stored as the current year followed
by the ID number, i.e, 2004-001. I tried using an input
mask, "2004-"000;0. However, when I tried to enter a
test value, 001, it didn't take the 1st zero, so I ended
up with "2004-01," which of course generated an error
message since it didn't satisfy the input mask rule
requiring 3 digits. Strangely, entering a number
beginning with a nonzero digit like 123 worked fine.
Does anyone know what I'm doing wrong? I could have them
enter an extra 0 for the first 99 records, but that seems
a little hokey. Any advice would be appreciated!
 
I have an ID variable defined as a text field. My users
want to have the ID stored as the current year followed
by the ID number, i.e, 2004-001. I tried using an input
mask, "2004-"000;0. However, when I tried to enter a
test value, 001, it didn't take the 1st zero, so I ended
up with "2004-01," which of course generated an error
message since it didn't satisfy the input mask rule
requiring 3 digits.

Rule 1: use two fields, not one. Have a YearCreated field and a
SerialNumber field, and then when you put it on a form or a report, make
the controlsource something like

= format(YearCreated,"0000") & "-" & format(Serial,"000")

so that they'll never know. But you'll know, because maintenance, sorting,
queries and everything else will be so much easier.

Rule 2: don't use input masks. They hardly ever do what you think they are
going to do, and merely confuse the user. A validation rule is probably
more use here, with some helpful code behind the form, but if you follow
rule one then you don't need anything of the sort.

Hope that helps


Tim F
 
Back
Top