PRB: Using SELECT-SQL INTO TABLE w/ Same Filename Causes Error

Last reviewed: April 30, 1996
Article ID: Q118780
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6

SYMPTOMS

The documentation for the SELECT-SQL INTO DBF <table> | TABLE <table> command (page C3-704 in the "Commands & Functions" manual for FoxPro version 2.0 and page L3-866 in the "Language Reference" manual for FoxPro versions 2.5x and 2.6) incorrectly states that by specifying the name of a table/.DBF that is already open, FoxPro closes the file and reopens the table without giving a warning if SET SAFETY is OFF. Instead, using the same filename in the Save As dialog box causes the error message "File is in use."

CAUSE

When a table is created with a SELECT-SQL statement, the original table is not closed as specified in the documentation when the same table name is used. FoxPro uses QUERY.DBF as the default table name when Table/DBF is selected in the Output list box. If the table name used for output is the same as the filename specified in the Tables dialog box, a syntax error is generated. In the following example, the CUSTOMER table is selected, Table/DBF is selected in the Output list box, and the default value is used in the Save As dialog box. Using these values, the following SELECT statement is generated, as illustrated by the See SQL button in the Relational Query by Example (RQBE) window.

   SELECT *;
     FROM Customer;
     INTO TABLE <path>\query.dbf

After you run the query, if you then select Table/DBF in the Output list box and then enter the same table name in the Save As dialog box (in this case, QUERY.DBF), the "File is in Use" error occurs.

RESOLUTION

To avoid this problem, use a different name for the file instead of the same table/.DBF name used in the Save As dialog box. Because a different filename is used in the INTO TABLE clause of the SELECT statement, the error will not occur.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60 Alias
errmsg
err msg
docerr
KBCategory: kbprg kberrmsg kbprb kbdocerr
KBSubcategory: FxtoolRqbe


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: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.