Siebel VB Language Reference > Siebel VB Language Reference >

Error Function


This standard VB function returns the error message that corresponds to the specified error code.

Syntax

Error[$] [(errornumber)]

Argument
Description
errornumber
An integer between 1 and 32,767 representing an error code

Returns

The text of the error message corresponding to the error code; if this argument is omitted, Siebel VB returns the error message for the run-time error that has occurred most recently.

If no error message is found to match the error code, a null string ("") is returned.

Usage

The dollar sign ($) in the function name is optional. If it is included, the return type is string. Otherwise the function returns a variant of vartype 8 (string).

The standard VB trappable errors are listed in Trappable Errors

Example

This example prints the error number, using the Err function, and the text of the error, using the Error$ function, if an error occurs during an attempt to open a file.

Sub Button_Click
   Dim msgtext, userfile
   On Error GoTo Debugger
   msgtext = "Enter the filename to use:"
   userfile = "c:\temp\trace.txt"
   Open userfile For Input As #1
   ' ....etc....
   Close #1
done:
   Exit Sub
Debugger:
   msgtext = "Error " & Err & ": " & Error$
      Resume done
End Sub

See Also

Erl Function
Err Function
Err Statement
Error Statement
On Error Statement
Resume Statement
Trappable Errors


 Siebel VB Language Reference
 Published: 18 June 2003