Notes on Microsoft Access Year 2000 Data Issues (PDF)

6 downloads 121 Views 55KB Size Report
Y2K and Access. Data. Information Systems and Technology. How Access Handles Dates. How dates are stored. MS Access supports a Y2K compliant data type ...
Y2K and Access Data Information Systems and Technology

How Access Handles Dates How dates are stored MS Access supports a Y2K compliant data type of “Date/Time” that stores the full, 4digit year. Data fields storing date information should always be declared with this data type; declaring them as a text field will lead to Y2K and other problems. Data of this type is actually stored as a double precision, floating point number with the integer portion storing the year and the decimal portion storing the time. Dates range from January 1, 100 (stored as –647,434) to December 31, 9999 (stored as 2,958,465); a date value of 0 represents December 30, 1899.

Access defaults to a “Short Date” style While the full 4-digit year is always stored, Access defaults to the “short date” style “mm/dd/yy” for the entry and display of dates. This format is defined under the “Date” tab of Regional Settings of the Control Panel. Year Assumptions used by Access Access 2.0

Dates with two digit years are always assumed to be in the 20th century

Access 96 (version 7.0)

Dates controlled by OLEAUT32.DLL. This originally implemented the rule that dates default to the current century

Access 97

Still based on OLEAUT32.DLL but with modified sliding rule: 30-99 default to 20th century, 0-29 default to 21st century

Date Problems with Access Incorrect Dates go unnoticed • Because of the default 2-digit year for both the input and display of data, incorrect date assumptions may go unnoticed. This is problematic when working with the years 1900-1929 (e.g. the age of someone in a nursing home) and the years 2030 (my retirement ) and beyond.

/

Literal Dates While the 4 digit year is retained for all dates stored in Access tables, literal dates are not! Literals may be entered in various other places in an application, for example: •

As a default value or Validation Rule in a table



As a criteria in a query



As logic in a module, for example if emp.birthdate > #12/31/30# then …

Note that Access creates these literals based on the Short Date style. If this specified a 2digit year (the default) then literals will be created with a 2-digit year even if a 4 digit year is entered by the user. For example, Access changes the line if emp.birthdate > #12/31/1930# … to if emp.birthdate > #12/31/30# … If the 4 digit year format is not used, the interpretation of the literal date may change over time. For example, the