PRB: Number of Records IMPORT/EXPORTed to Spreadsheet Differs

Last reviewed: June 26, 1995
Article ID: Q109839
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, and 2.5b

SYMPTOMS

If you use the COPY TO or EXPORT TO commands to export a database to a spreadsheet file type, and then use the APPEND FROM or IMPORT FROM commands to import that spreadsheet back into a database, the number of records FoxPro reports copied (during the export) is one less than the number of records it reports added (during the import).

CAUSE

When you are copying to a spreadsheet file type, the COPY TO and EXPORT TO commands add an extra record (row) to the beginning of the destination file (spreadsheet). This record contains the names of the database fields and is not included in the FoxPro message that reports the number of records copied, since it is not an actual database record.

However, when the APPEND FROM or IMPORT FROM command imports the records (rows) from that same spreadsheet back into a database, the extra record containing the field names is treated like any other record in the spreadsheet, so FoxPro includes it when reporting the number of records added/imported.

MORE INFORMATION

This information applies to the following file types:

   DIF, MOD, SYLK, WK1, WKS, WR1, WRK, XLS

Steps to Reproduce Behavior

  1. Start FoxPro.

  2. Create and run a program with the following code:

          SET STATUS ON    && So you can see all messages on the desktop
          CREATE TABLE test (charfld C(20), numfld N(10))
          INSERT INTO test (charfld, numfld) VALUES ('Chris Tester', 1234)
          COPY STRUCTURE TO copytest.dbf
    
          COPY TO copytest.xls TYPE XLS
           * Message on Desktop: 1 records copied
          EXPORT TO exp-test.xls TYPE XLS
           * Message on Desktop: 1 records copied
    
          USE copytest.dbf
          APPEND FROM copytest.xls TYPE XLS
           * Message on Desktop: 2 records added
    
          USE
          IMPORT FROM exp-test.xls TYPE XLS
           * Message in Wait window: 2 Records Imported
    
    
For more information about the extra row created by the COPY TO and EXPORT TO commands, query on the following words here in the Microsoft Knowledge Base:

   exported and first and record and field and names


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 2.50b
KBCategory: kbprg kbprb
KBSubcategory: FxinteropSpread


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: June 26, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.