BUG: SET KEY TO Command Ignores Characters in the Expression

ID: Q121638

The information in this article applies to:

SYMPTOMS

When a database is ordered on a numeric field, the SET KEY TO command ignores characters placed in the expression.

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

The SET KEY TO command is a dBASE-compatible command used to limit access to records that meet a specified criteria. The value placed in the command must be of the same data type as that of the current index tag. When a numeric database tag is set and the SET KEY TO command is issued on a character expression, the character part of expression is ignored. This behavior is best demonstrated using the CLIENTS database located in the SAMPLE\ORGANIZE\DBFS subdirectory of the FoxPro 2.6 directory.

Steps to Reproduce Behavior

1. Open the CLIENTS database.

2. Modify the CLIENTS.CDX index file by adding a tag based on the TYPE

   field, and set the order to this tag.

3. In the Command window, issue the following commands:

      SET KEY TO 2
      BROWSE

   Note that only type 2 records appear.

4. Close the Browse window and issue the following command to clear the SET
   KEY TO command:

      SET KEY TO

5. In the Command window, issue the following commands:

      SET KEY TO 2e
      BROWSE

Note that the Browse window continues to show the same records. If the same command is issued in dBASE, it causes an error message.

Additional reference words: FoxDos FoxWin 2.60 2.60a buglist2.60 buglist2.60a KBCategory: kbprg kbbuglist KBSubcategory: FxprgBrowse

Last Reviewed: August 28, 1995