BUG: AFIELDS() Array Causes Error in CREATE...FROM ARRAY

Last reviewed: April 24, 1997
Article ID: Q158256
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a

SYMPTOMS

When you create a table from the table structure contained in an array built by Visual FoxPro 5.0's AFIELDS() function, a message dialog box informs you that the table name you specified for that new table is already used for another object. The dialog box asks you to choose another table name.

The dialog box options are OK and HELP. When you click OK, the new table is created with the name you originally specified. However, the new table contains a back-link to the database containing the source table, which you will discover the next time you "USE" the new table.

CAUSE

New to Visual FoxPro 5.0 are the 12th through 16th columns of the AFIELDS() array. The 12th column contains the long file name of the table. The CREATE ... FROM ARRAY command sees this value and interprets it to mean the new table should have the same value. This triggers the message dialog box to the user.

When the user responds, other functionality in the CREATE ...FROM ARRAY command proceeds to create the desired table with the name the user specified.

Erroneously, the CREATE ... FROM ARRAY command then includes the back link from the original table, based on the (long) file name value in column 12 of the array.

When the new table is being opened in a work area, a dialog box states that "<the database in the back-link> cannot link table <the table to be opened> to the database: duplicate or missing fields. Would you like to try to locate the owning database or delete the link (and free the table)?"

WORKAROUND

The problem is two-fold. When the first dialog box appears, click OK to create the table.

When the second dialog box appears, choose the Delete option to delete the back-link and free the table. If you then want the new table to belong to a database, you need to deliberately add it to that database.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In the Command window enter the following commands:

          CREATE DATABASE mydata
          CREATE TABLE mytable (mychar c(1))
          =AFIELDS(laStru)
          CREATE TABLE another_table FROM ARRAY laStru
    

  2. When the following dialog box appears, click the OK button.

          The name mytable is already used for another object. Please choose a
          different name.
    

    Then enter the following command:

          USE another_table
    

  3. When the following dialog box appears, click Delete:

          C:\Vfp50\mydata.dbc cannot link table C:\Vfp50\another_table.dbf to
          this database: duplicate or missing fields. Would you like to try to
          locate the owning database or delete the link (and free the table)?
    

    (The path shown above is different to reflect the actual path to the database.dbc and table.dbf on your system.)

The empty table "another_table" can now be seen in a work area.


KBCategory: kbprg kbtshoot kbbuglist
KBSubcategory: FxprgTable VFoxWin buglist5.00
Additional reference words: 5.00
Keywords : buglist5.00 FxprgTable kbprg VFoxWin vfpbug5.0a kbbuglist
Version : 5.0a 5.0
Platform : WINDOWS
Issue type : kbbug


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 24, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.