Microsoft KB Archive/249900

From BetaArchive Wiki
Knowledge Base

Article ID: 249900

Article Last Modified on 5/12/2003


  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 5.0 Standard Edition
  • Microsoft Visual FoxPro 5.0a
  • Microsoft Visual FoxPro 6.0 Professional Edition
  • Microsoft FoxPro 2.5b
  • Microsoft FoxPro 2.5a
  • Microsoft FoxPro 2.5b
  • Microsoft FoxPro 2.6 Standard Edition
  • Microsoft FoxPro 2.6a Standard Edition

This article was previously published under Q249900


An error message may appear in some applications when you open or import a FoxPro table that was created or modified after 12/31/1999.


The error message may be caused by one of the following:

  • The second byte of the FoxPro table header is a hex value and is reset to 00 in the year 2000 and increments by 1 each year (that is, 01 in 2001) by FoxPro. Some applications treat this value as an offset from 1900 and continue to increment the hex value (63, 64, 65 ... representing 1999, 2000, 2001 ...). The original file format definition allowed some ambiguity, so either interpretation is common.
  • If the application is reading the second byte of the FoxPro table header, which represents the year of table creation or modification, then the hexadecimal 00 may be interpreted as character NULL rather than a date.
  • The application may add the value of the second byte of the FoxPro table to the year 1900.


The FoxPro table header stores the information for the date of creation or modification of the table. The code in Method 1 changes the second byte of the header to the CHR() value of the year of the system date minus 1900. Please note that the changes to the table header shown in Method 1 and Method 2 are temporary. The next time FoxPro modifies the table header, for example when it appends a blank record, the byte reverts back to its original value.

To resolve this problem, use one of the following methods: METHOD 1

This method works for FoxPro versions 2.x and all versions of Visual FoxPro.

  1. Copy the following code and save it in a .prg file:

       IF EMPTY(fname)
            fh = FOPEN(fname,12)
       IF fh < 0
            WAIT 'Cannot open or create output file' WINDOW NOWAIT
            =FSEEK(fh, 1, 0)
            =FWRITE(fh, CHR( YEAR( DATE() ) - 1900))  
            WAIT 'File Updated Successfully' WINDOW NOWAIT
  2. Run the .prg file and choose a .dbf file to be updated.


This method only works for Visual FoxPro 5.0 and 6.0.

  1. Run the Hexedit.scx form from the SYS(2004)+"\Tools\Hexedit" folder by using the following command:

    DO FORM SYS(2004)+"\tools\hexedit\hexedit"
  2. Select the .dbf file to be updated.
  3. Click the value of column 1 for address 00000000.
  4. Change the value from 00 to CHR(YEAR(DATE()) - 1900). For example, use 64 for 2000, and 65 for 2001.
  5. Click Close.
  6. Click Yes to save the sector on the disk.


Use the Visual FoxPro ODBC driver to connect to the table.


This behavior is by design.


Additional query words: Y2K

Keywords: kbcodesnippet kbdatabase kbprb kb3rdparty KB249900