PRB: Unable to Open/Import FoxPro Table in Some Third-Party Applications
ID: Q249900
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a, 6.0
-
Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
SYMPTOMS
An error message might appear in some third-party applications when opening or importing a FoxPro table that was created or modified after 12/31/1999.
CAUSE
Two known causes of this are:
- If the third-party application is reading the second byte of the FoxPro table header, which represents the year of table creation or modification, then the hexadecimal 00 might be interpreted as character NULL rather than the year 2000.
- The third-party application might add the value of the second byte of the FoxPro table to the year 1900.
RESOLUTION
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, such as when appending a blank record, the byte reverts back to its original value.
METHOD 1
This method works in FoxPro versions 2.x and all versions of Visual FoxPro:
- Copy the following code and save it in a .prg file.
- Run the .prg file and choose a .dbf file to be updated:
CLOSE ALL
fname=GETFILE("dbf")
IF EMPTY(fname)
RETU
ELSE
fh = FOPEN(fname,12)
ENDIF
IF fh < 0
WAIT 'Cannot open or create output file' WINDOW NOWAIT
ELSE
=FSEEK(fh, 1, 0)
=FWRITE(fh, CHR( YEAR( DATE() ) - 1900))
=FCLOSE(fh)
WAIT 'File Updated Successfully' WINDOW NOWAIT
ENDIF
METHOD 2
This method only works with Visual FoxPro 5.0 and 6.0:
- Run the form HEXEDIT.SCX from the SYS(2004)+"\tools\hexedit" folder using the following command:
DO FORM SYS(2004)+"\tools\hexedit\hexedit"
- Select the .dbf file to be updated.
- Click on the value of column 1 for address 00000000.
- Change the value from 00 to 63.
- Click Close.
- Click Yes to save the sector on the disk.
METHOD 3
Use the Visual FoxPro ODBC driver to connect to the table.
STATUS
This behavior is by design.
MORE INFORMATION
For more information about how Microsoft products are affected by year 2000
(Y2K) issues, please see the following Microsoft World Wide Web site:
http://www.microsoft.com/year2000/
Additional query words:
Y2K
Keywords : kb3rdparty kb2000 kbDatabase kbVFp300 kbVFp500 kbVFp600 KbDBFDBC kbGrpFox kbDSupport kbCodeSnippet
Version : WINDOWS:2.5,2.5a,2.5b,2.6,2.6a,3.0,3.0b,5.0,5.0a,6.0
Platform : WINDOWS
Issue type : kbprb