Input Masks for Dates

  • Thread starter Thread starter Terressa
  • Start date Start date
T

Terressa

I have a database that every time I try to put any birthdate below 1930 it
will automatically put 20 instead of 19 (putting in 1925 turns it to 2025). I
stumped on how to fix it. Please help. :)
 
I have a database that every time I try to put any birthdate below 1930 it
will automatically put 20 instead of 19 (putting in 1925 turns it to 2025). I
stumped on how to fix it. Please help. :)

You can 'fix' it by entering a 4 digit year instead of a 2 digit year.
Ever since the Year2K date fix, Access will assume any date entered
with just 2 digits of 00 to 29 for the year is 21st Century (2000 to
2029), while a 2 digit year of 30 to 99 is 20th Century (1930 to
1999).
Don't make access guess. Enter the date as mm/dd/yyyy.
 
There's a setting in the Windows Control Panel, under Regional Settings,
where you tell Windows how to interpret a 2-digit date. By default, anything
below '30 is treated as this century, and anything above that is treated as
last.

You can modify the setting there, but this will affect all your Windows
programs. Alternatively, you could write code in the AfterUpdate event
procedure of the control so that if the date has past, it adds 100 years to
it.

If you need an example to follow, this one may help:
http://allenbrowne.com/func-AdjustDateForYear.html
It actually works with the year rather than the century (i.e. if you enter a
December date in February, it treats it as the Dec just past, not the future
Dec of this year.)
 
I have a database that every time I try to put any birthdate below 1930 it
will automatically put 20 instead of 19 (putting in 1925 turns it to 2025). I
stumped on how to fix it. Please help. :)

Actually, putting in /25 as the year will put in 2025. If you explicitly put
in 1925 (or 1825, or 225) it will honor your choice.

Two-digit years are interpreted as being in the 21st century for values 00
through 29, and 20th century for 30 through 99. Since a two-digit entry is
inherently ambiguous, there must be SOME convention to assign the century, and
the Microsoft designers chose 30 as the breakpoint.
 
Back
Top