BUG: ON ERROR Does Not Trap "Alias Not Found" Error (191315)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q191315

SYMPTOMS

Visual FoxPro's ON ERROR command does not trap the following error:
Alias not found error (error 13).

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

Create a program that contains the following code and run the program:
   SET SAFETY OFF
   ON ERROR WAIT WINDOW ("FIRST ON ERROR: " + CHR(13) + MESSAGE())
   CREATE DATABASE Ztest
   CREATE TABLE Ztest (FirstName C(20), LastName C(20))
   USE Ztest EXCLUSIVE
   INDEX ON LEFT(Ztest.FirstName,6) TAG FIRST6 OF Ztest && Comment this
                                                        && line.
   SELECT Ztest
   USE
   SET SAFETY OFF
   ON ERROR WAIT WINDOW ("Second ON ERROR: " + CHR(13) + MESSAGE())
   USE Ztest  ALIAS CLOSE_Ztest
   SET ORDER TO TAG FIRST6
   USE
   ON ERROR
   *  Clean up and delete files.
   CLOSE ALL
   DELETE FILE Ztest.DBC
   DELETE FILE Ztest.dcx
   DELETE FILE Ztest.dct
   DELETE FILE Ztest.DBF
					
Run the program and note that the ON ERROR routine traps the following error:
Variable 'First6' not found.
Next, place an asterisk (*) in front of the INDEX ON command in the code. Run the code again and note that the ON ERROR command does not trap the "Alias not found" error. In addition, the ON ERROR command does not trap error 13 when evoked from the Command window either.

Modification Type:MajorLast Reviewed:5/12/2003
Keywords:kbbug kbcode kbnofix KB191315