ACC: Cannot Import YYMMDD Dates in Fixed-Width Text Files

Last reviewed: May 28, 1997
Article ID: Q93727
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 7.0, 97

SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

Microsoft Access will not import fixed-width text files if there is a Date field in the text file formatted as YYMMDD.

CAUSE

Microsoft Access does not recognize the YYMMDD Date format in text files.

RESOLUTION

One workaround is to format the date as MMDDYY.

Another workaround is to import the YYMMDD field as a six-character Text field. Next, create a new field in the table called, for example, NewDate, with a data type of Date/Time. Then run an update query to derive the NewDate field from the OldDate field as follows.

NOTE: In the following example, an underscore(_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this example.

   Query: ReformatDate
   ------------------------------------------------------------
   Field Name: NewDate
   Update to: Mid([OldDate],3,2) & "/" & Right([OldDate],2) & _
                  "/" & Left([OldDate],2)

If the Text field containing the date has embedded slashes, such as 1/5/94, then the starting value in the Mid() function must be 4 rather than 3. In the example above, you would change the Mid() function to look as follows:

   Mid([Olddate],4,2)

MORE INFORMATION

In Microsoft Access 7.0 and 97, when importing a fixed-width text file with a Date field formatted as YYMMDD, Microsoft Access generates an Import Error log table, but does not import the data for the Date field. If you try to import the text file as delimited, the data is imported, but Microsoft Access changes the format from Date to Number or Text, depending upon the date delimiter. In Microsoft Access 2.0 or earlier, the file will not be imported.


Additional query words: convert year month day
Keywords : IsmTxtfx kb3rdparty
Version : 1.0 1.1 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.