MSQuery Err Msg: "Cannot Define Primary" in Paradox Table

Last reviewed: September 12, 1996
Article ID: Q111046
The information in this article applies to:
  • Microsoft Query for Windows, version 1.0
  • Microsoft Query for Windows 95, version 2.0

SUMMARY

In Microsoft Query, when you create an index for an existing Paradox table, you may receive the following error message:

   Cannot define primary

CAUSE

This error message appears if the table you are creating an index for contains data. You cannot create a unique index for a Paradox table that contains data.

WORKAROUND

To create an index on a field in a Paradox table, do either of the following:

  • Open the table in Paradox and assign a primary key to one of the fields in your table. Until you define a primary key in the table, you cannot edit the data in the table in Microsoft Query.

    -or-

  • To create a new Paradox table from the existing table, and create an index for the new table in Microsoft Query, do the following:

    1. From the File menu, choose New Query. From the Available Data

          Sources list, select Paradox Files and choose Use.
    

    2. From the Table Name list, select the table for which you want

          to add an index, and choose Add. Choose Close.
    

    3. From the Field List, drag the asterisk to the data pane.

    4. From the File menu, choose Save As. From the Save As list,

          select Paradox Files and choose Save. In the File Name box,
          type the name of your new table. Select the Save Indexes check
          box, and choose OK.
    

    5. Choose Yes to create a unique index in the table.

    6. In the Index Name box, type the name of the table you saved in

          step 4 (the name of the primary index must match the name of
          the table). From the Index Fields list, select the name of the
          field you want to index. Choose Add.
    

These steps will create a new table with the fields and data contained in the original Paradox table.

MORE INFORMATION

In Microsoft Query, when you create an index on a field in a Paradox table that does not contain any data, the name of the index you are creating must match the name of the table. Additionally, you can only create an index on the first field in the table. If you create an index on a field other than the first field in the table, you receive the following error message

   Illegal index definition

and the index is not created.

You cannot edit data in a Paradox table in Microsoft Query unless a primary key has been defined in the table. Because in Microsoft Query you cannot create an index on a field in a Paradox table that contains data, you must add a primary key to the table in Paradox in order to edit the data in the table in Microsoft Query. When you attempt to edit a table in Microsoft Query that does not have a primary key defined for one of the fields, you will receive the following error message

   Can't open unkeyed Paradox table.

   Unable to open table: TABLENAME.

where TABLENAME is the name of the table you are editing.

The Paradox products included here are manufactured by Borland, Inc., vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.

REFERENCES

For more information about the Create Index Dialog Box, or the Table Definition Command (File Menu), choose the Search button in Help and type:

    indexing fields


KBCategory: kbtool kberrmsg
KBSubcategory: xlquery

Additional reference words: 1.00 2.00 5.00 5.00c



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