Date input mask questions

B

BobV

Group:

I have a field on a form that I have formatted as a Short Date and have also
set the Data Input Mask property to be 99/99/0000;0;

When a user enters a two digit year instead of a four digit year, the user
gets the following error message:
"The value entered isn't appropriate for the input mask '99/99/0000;0;'
specified for this field.

QUESTION:
Is there a way to program my own error message to appear when a two digit
year is entered instead of a four digit year? I want to have a simple error
message that says:
"You must enter a four digit year. For example 12/31/2005. Please re-enter
the date."

Thanks,
BobV
 
J

Joan Wild

BobV said:
I have a field on a form that I have formatted as a Short Date and
have also set the Data Input Mask property to be 99/99/0000;0;

Is there a way to program my own error message to appear when a two
digit year is entered instead of a four digit year? I want to have a
simple error message that says:
"You must enter a four digit year. For example 12/31/2005. Please
re-enter the date."

I would suggest you reconsider both the format and the input mask for the
control. The Short Date format will use whatever the short date format is
set for the computer in Regional Settings. This could be dd/mm/yyyy or
mm/dd/yyyy. If a person enters 2/7/2005 it will display 2/7/2005 but that
could be February 7 or July 2 and it is confusing if the person is unaware
of their settings. They won't even know. Even if they enter a date that
doesn't 'work' with their Regional Settings (i.e. they're set to mm/dd/yyyy
and they enter 13/02/2005) Access will spin this around until it can make a
date out of it. If you instead use a format of mmm/dd/yyyy, they'll
immediately see if their entry is misinterpreted. They can then either
change the way they enter dates or change their Regional Settings.

An input mask on a date field can be very frustrating to an end user. You
are forcing them to enter more than they need to. On my computer (set to
dd/mm/yyyy) I can enter just 13/7 in a date/time field and Access will
assume the current year and correctly enter todays date. I would just leave
the input mask off altogether, and let the format confirm for them, what
they've entered.

More information on working with dates:
http://members.iinet.net.au/~allenbrowne/ser-36.html
 

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