input mask or validation rule?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field called TIN that has to be 9 digits long. How can I enforce
this on the form? I tried the input mask but the "_" is annoying the users
because sometimes their cursor isn't at the beginning of the field and they
need to fix their data entry. Is there a better way to do this?

Along the same line, Phone is another one where I need to have the entry in
###-###-#### format and I am hearing the same complaint about the underscore
that appears while they are entering the number.

Any help is really appreciated!
 
Lori,
Read Input Mask Property in Help. There are 3 possible sections to the InputMask,
separated by ";"

First Specifies the input mask itself; for example, !(999) 999-9999. For a list of
characters you can use to define the input mask, see the following table.

Second Specifies whether Microsoft Access stores the literal display characters in the
table when you enter data.

And, the Third which is what is causing the underscores....
Third Specifies the character that Microsoft Access displays for the space where you
should type a character in the input mask. For this section, you can use any character; to
display an empty string, use a space enclosed in quotation marks (" ").

The default telephone mask is
\(999") "000\-0000;;_
To remove the "_"s
!\(999") "000\-0000;;" "
 
Look up InputMask in VBA Help. It has 3 sections.
First, the mask for the phone number, the ###-###-#### would be correct.
Second, determines whether the extra characters are stored in the field. 0
means the dashes would be stored, blank or 1 means only the input would be
stored.
Third, the character to use to show the space where the character should be
entered. the _ is the default.
So, the input mask for a phone number where only the digits are stored and
no character is shown would be ###-###-####; 1; " "

If you continue having problems with where the cursor is positioned, try
putting this in the Got Focus event of the control:
Me.Selstart = 0
 
Back
Top