KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q140760: PRB: Invalid Key Length Error When Indexing a Cursor File

Article: Q140760
Product(s): Microsoft FoxPro
Version(s): WINDOWS:3.0,5.0,6.0
Operating System(s): 
Keyword(s): kbvfp300 kbvfp500 kbvfp600
Last Modified: 11-DEC-1999

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual FoxPro for Windows, versions 3.0, 5.0, 6.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

Indexing a cursor file with a key field that contains more than 240 characters
generates this error:

  Invalid Key Length

This procedure did not generate an error in FoxPro version 2.6.

CAUSE
=====

This is a deliberate change in behavior. The maximum length for an index key in
a compact index is 240 bytes. If a key is longer than 240, FoxPro 2.6 truncates
it. Visual FoxPro 3.0, 5.0 and 6.0 display the "Invalid Key Length" error
message to protect against the possiblity of generating duplicates.

STATUS
======

This behavior is by design.

MORE INFORMATION
================

This error message also occurs with a table.

Steps to Reproduce Behavior
---------------------------

Type the following commands in the Command window:

     CREATE CURSOR Address (address C(254))
     INDEX ON address TAG address

The "Invalid Key Length" error message is displayed.

REFERENCES
==========

For more information on Visual FoxPro 3.0 system capacities, search for "System
capacities" in the FoxPro Help file.

Additional query words: VFoxWin

======================================================================
Keywords          : kbvfp300 kbvfp500 kbvfp600 
Technology        : kbVFPsearch kbAudDeveloper kbVFP300 kbVFP500 kbVFP600
Version           : WINDOWS:3.0,5.0,6.0
Issue type        : kbprb

=============================================================================

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.

Copyright Microsoft Corporation 1986-2002.