Error Instruction/Function

Syntax:

Error ErrorCode

-or-

Error[$]([ErrorCode])

Group: Error Handling

Description:
Instruction: Signal error ErrorCode. This starts error handling just like a real error. The current procedure's error handler is activated, unless it is already active or there isn't one. In that case the calling procedure's error handler is tried. (Use Err.Raise to provide complete error information.)

Function: The Error( ) function returns the error text string.

Parameter Description

ErrorCode This is the error number.

Example:

Sub Main
  On Error GoTo Problem
  Err.Raise 1 ' simulate error #1
  Exit Sub

  Problem: ' error handler
  Debug.Print "Error$=";Error$
  Resume Next
End
Sub