Question about Input Masks

testdba

Registered User.
Local time
Today, 03:55
Joined
Dec 16, 2004
Messages
26
I'm just curious. Input masks can be put on a text field in the table or on the textbox of a form. Is there any advantage to masking one over the other?
 
An input mask on a form "masks" what is typed in to the appropriate format. If the mask is on the table alone then when a user attempts to update and doesn't know the appropriate format they get an error.

In my opinion, if you want a specific format only, then put a mask at both locations. However, for dates I prefer to only mask the form. Reason being, I set the format on the table to be general date which includes a time stamp and on the form I mask it to short date. The user only inputs the short date but I also get a time stamp as well. This is useful later on for different reports, queries, etc..

Hope this helps.
 
Hey thanks for the tip about the date! I have a project that I have been messing with where I can use that!
 
You are confusing the Input Mask with the Output Format. A Mask is used to control how data is entered. A Format controls how data is displayed.

I never use an input mask for dates. I find them more annoying than helpful. The mask doesn't restrict characters so the user can enter 99/99/99 without error. It is only when he tabs to the next field that Access itself validates the field and raises an error because it is not a valid date. So, adding a mask does not add value to this process. It only forces the user to enter all three parts of a date, he can't omit the year part and allow it to default to the current year.
 
Yes that is true, but I use the input mask on dates because the user doesn't have to type "/" and they see the format. Since I use short date for the format on the text box on a form and I use an input mask as well, I force the user to not only see the format but make sure it is input as well. Many of my forms trigger queries with date searches using between two text box values. I have found when programming for the LCD this is the best way. It may not be the "correct" or "proper" way but it works with out failure.
 
In order to avoid typing two slashes, the user needs to enter leading zeros on day 30% of the time, leading zeros on month 75 % of the time and 2 or 4 digits years (depending on your mask) 100% of the time. If they don't want to enter the leading zeros, they can enter the slashes so they're typing the same number of characters much of the time. Try the effect of defining the format of an unbound field as short date. Access will not let you exit from the field if the entered date is invalid.

As long as the date being entered is for the current year, you can omit it (You can't do that with a mask) so take a look at the following.
Code:
9 * 9    = 81  = 3 char - single digit month, single digit day    22.5%
9 * 21  = 189 = 4 char - single digit month, double digit day   52.5%
3 * 9    = 27  = 4 char - double digit month, single digit day     7.5%
3 * 21  = 63  = 5 char - double digit month, double digit day  17.5%
= 360 day bankers year
82.5% of the time, you can enter a date with 4 or fewer keystrokes vs. 8 keystrokes 100% of the time when you use the typical - 99/99/0000;0;_ as the input mask.

That's why I don't use masks on my dates. Masks on other field types are a different issue. They do add value for fields such as telephone numbers or ss numbers. But, to my mind, not for dates. Just make sure that you set the control's Format to short date (if the control is unbound) so that Access knows the data is supposed to be a date. If the control is bound, the table definition will prevent an invalid date from being saved so you don't have to worry about setting a format.
 
Good point Pat. Once again all knowing. One funny thing though..I have tried for years to get my $%&^#$%^ users to just type the last two digits of the year if in the current century and I can't get them to accept it. For most of them they are set in typing /, full years, and all sorts of extra crap that I can't get them to break from.

P.S. Congrats on the 2000 Monroe Magnus Sectional Race win. (I am assuming this is you.)
 
Yes it was me :) If the users want to type 10 characters to enter a date, that's fine. As long as it is their choice.
 

Users who are viewing this thread

Back
Top Bottom