Advantage of Date/Time Input Mask?

  • Thread starter Thread starter Kurt
  • Start date Start date
K

Kurt

I often use these input masks for date and time fields on
forms:
Date Time
-------------------------------
Format Short Date Medium Time
Input Mask !99/99/0000;;" " 09:00\ >LL;0

However, I find that many users get tripped up while
trying to enter the date or time if they don't follow the
input mask. Are these input masks really necessary?

For instance, if I don't use an input mask, the user has
the flexibility to enter either 2/5/02 or 2/5/2002 or
02/05/2002 and the date (or, it's formatting at least)
defaults to "2/5/2002." If I don't use an input mask,
will I encounter problems when I try to sort records by
date, time, etc.?

Kurt
 
I don't use date/time input masks because they sometimes produce wrong
values if the user clicks into the middle of the mask, etc.

Instead, format the control to a date/time format. That will automatically
validate that the user is entering an appropriate date/time format. You also
can use the control's BeforeUpdate event to do additional validations on the
value.

How a date/time value is displayed has *nothing* to do with how the value is
actually stored in ACCESS. ACCESS stores date and time as a single,
double-decimal number:
Date.Time

where Date is the integer portion of the number and Time is the fractional
portion.

The date is stored as the number of days since December 31, 1899. The time
is stored as the fraction of a 24-hour day. Thus, for example, 1:05 pm on
November 15, 2003 is stored as this number:
37940.5451388889

This number is what ACCESS uses in queries, etc. for actually matching
things. You control how it's displayed by the format of the field or the
control, or by using the Format function.
 
Kurt said:
I often use these input masks for date and time fields on
forms:
Date Time
-------------------------------
Format Short Date Medium Time
Input Mask !99/99/0000;;" " 09:00\ >LL;0

However, I find that many users get tripped up while
trying to enter the date or time if they don't follow the
input mask. Are these input masks really necessary?

For instance, if I don't use an input mask, the user has
the flexibility to enter either 2/5/02 or 2/5/2002 or
02/05/2002 and the date (or, it's formatting at least)
defaults to "2/5/2002." If I don't use an input mask,
will I encounter problems when I try to sort records by
date, time, etc.?

If the user is taught to click on the label rather than the field they will
be in the right spot.

However I never use them unless the client insists.

Without them the user can enter month space day and access will add the
year.
11 15 is formatted as 11/15/2003 or what ever you want it to.
A danger around the beginning of the year but this is a training issue and
12 15 03 fixes it.
 
For instance, if I don't use an input mask, the user has
the flexibility to enter either 2/5/02 or 2/5/2002 or
02/05/2002 and the date (or, it's formatting at least)
defaults to "2/5/2002." If I don't use an input mask,
will I encounter problems when I try to sort records by
date, time, etc.?


None at all, unless you have some users who interpret 2/5/02 as
February 5th and others as the Second of May.

A Date/Time value - however it's formatted or masked - is stored
internally as a double float number, a count of days and fractions of
a day (times) since midnight, December 30, 1899. Doesn't matter how
the user types it, it ends up the same number.

I agree with you: the input mask for dates is usually a lot more
hassle than benefit!
 
Back
Top