BUG: Err.Raise 40040 Stores the Err.Number as 440 (216547)



The information in this article applies to:

  • Microsoft Visual Basic Learning Edition for Windows 5.0
  • Microsoft Visual Basic Learning Edition for Windows 6.0
  • Microsoft Visual Basic Professional Edition for Windows 5.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 5.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

This article was previously published under Q216547

SYMPTOMS

When the statement Err.Raise 40040 is executed, the value of Err.Number is set to 440.

RESOLUTION

Do not use the user defined error 40040.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

If you raise the error code 40040 (=&H9C68) using the Err.Raise method, Visual Basic sets the value of Err.Number to 440. The Err.Description and other properties of the Err object are set correctly.

Steps to Reproduce Behavior

  1. Create a Visual Basic Standard EXE project. Form1 is created by default.
  2. Paste the following code in the General Declarations section of Form1:
    Private Sub Form_Load()
       On Error Resume Next
       Err.Raise 40040
       MsgBox Err.Number & ": " & Err.Description ' will display 440
       Err.Clear ' Clear the error for the next Raise method
       Err.Raise 440
       MsgBox Err.Number & ": " & Err.Description
    End Sub
    						
  3. Run the program. A message box with the error number and description raised for 40040 will be displayed.
  4. Click OK and a message box with the error number and description raised for 440 will be displayed.

Modification Type:MajorLast Reviewed:5/12/2003
Keywords:kbBug KB216547