Stopping autocorrection of dates

  • Thread starter Thread starter Chris Rottiers
  • Start date Start date
C

Chris Rottiers

Is there a way to prevent Access from automatically fixing
incorrect dates. For example:

31-12-95 turns into 31-DEC-95
12-31-95 turns into 31-DEC-95
01-15-03 turns into 15-JAN-03
15-01-03 turns into 03-JAN-2015

Thanks
 
You will have to set up the Format property. To do that go to the table set
up the field with Date/Time on the Input Mask press the Build Button (...),
then Edit List. There you select Date/Time, and set up your new format.
Once done you date entry will be set to that input. Oh, you will probably
have to go to all the forms that contain that particular field and select
that format from the drop down list.

Suggestion: try it first, make a test field so you are sure you are getting
what you want. Now if you trust your users you can just set the field to
Text and hope and pray they enter it correctly.

Hope that helps...
 
Chris,

I assume then that you want these to show up in that
format (either DD-MM-YY or MM-DD-YY). In that case you
need to enter the following into the Format Block "mm-dd-
yy" or "dd-mm-yy". If you want to input it this way, then
I might sugest that you put the following in your input
mask: 99/99/00;0;_ These should fix the issue as long as
this is really a date field. If you want this to be a
number field it will work differently.

HTH

AJ
 
The short answer, Chris, is no, you can't prevent that. My understanding
(from comments in previous newsgroup discussions) is that this behaviour is
actually not controlled by Access, but by one of the Windows system DLLs
(OLEAUT32.DLL, if I remember correctly).

In one app where I thought this might be a particular problem, what I did
was to place two text boxes on the form, both bound to the same date/time
field, both with the Format property set to 'Long Date'. The idea was that
when the user entered a date in the first text box and tabbed out of that
text box, the focus would land in the second text box, displaying the date
the user just entered in long date format. This made it much more likely
that the user would notice if the date was not the date they intended to
enter, and if it was not they could easily correct it.

Validation also helps. Checking that the date is within a reasonable range
(e.g. <= Date() + SomeNumberOfDays And >= Date() - SomeNumberOfDays) can
catch many of these silent 'fixes'.
 
Hi Chris,

Chris Rottiers said:
Is there a way to prevent Access from automatically fixing
incorrect dates. For example:

31-12-95 turns into 31-DEC-95
12-31-95 turns into 31-DEC-95
01-15-03 turns into 15-JAN-03
15-01-03 turns into 03-JAN-2015

It can certainly be annoying, at times, but if you understand how Access
interprets your entry, you can regain sanity.

I'm not sure if 01/08/03 is August 1 or Jan 8, or what? Access does not
make random decisions about this, it uses the short
date settings on your computer to assume what you mean by your entry.

Go into Control Panel, Regional Settings, Date tab, and see what your
computer is set to. If it is
m/d/y and you enter 08/05/03, it will assume you mean Aug 5. However if you
enter 13/05/03, that
doesn't conform to your Regional Settings (there is no 13th month). Access
will still enter a date
for you though - it 'helpfully' spins your entry around until it can make
sense of it - May 13,2003.
This is why it can be very confusing to users, as it would appear that
Access arbitrarily changes
your date entries. It's really only doing this after the 12th of the month.

Change your Regional Settings to suit how you like to enter dates. I would
also suggest you choose
a format for your field/control that is unambiguous such as dd/mmm/yyyy.
This way you will see
immediately whether Access interpreted your entry as you meant.

For more information on dates see
http://users.bigpond.net.au/abrowne1/ser-36.html
 
Hi Chris,

Chris Rottiers said:
Is there a way to prevent Access from automatically fixing
incorrect dates. For example:

31-12-95 turns into 31-DEC-95
12-31-95 turns into 31-DEC-95
01-15-03 turns into 15-JAN-03
15-01-03 turns into 03-JAN-2015

It can certainly be annoying, at times, but if you understand how Access
interprets your entry, you can regain sanity.

I'm not sure if 01/08/03 is August 1 or Jan 8, or what? Access does not
make random decisions about this, it uses the short
date settings on your computer to assume what you mean by your entry.

Go into Control Panel, Regional Settings, Date tab, and see what your
computer is set to. If it is
m/d/y and you enter 08/05/03, it will assume you mean Aug 5. However if you
enter 13/05/03, that
doesn't conform to your Regional Settings (there is no 13th month). Access
will still enter a date
for you though - it 'helpfully' spins your entry around until it can make
sense of it - May 13,2003.
This is why it can be very confusing to users, as it would appear that
Access arbitrarily changes
your date entries. It's really only doing this after the 12th of the month.

Change your Regional Settings to suit how you like to enter dates. I would
also suggest you choose
a format for your field/control that is unambiguous such as dd/mmm/yyyy.
This way you will see
immediately whether Access interpreted your entry as you meant.

For more information on dates see
http://users.bigpond.net.au/abrowne1/ser-36.html
 
Back
Top