Error Instruction/Function

Syntax:

Error ErrorCode

OR

Error[$]([ErrorCode])

Group:

Error Handling

Description:

Instruction: Signal error ErrorCode. This triggers 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

Return the absolute value of this numeric value. If this value is Null then Null is returned.

 

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