Siebel VB Language Reference > VB Language Reference >

Err Statement


This standard VB statement sets a run-time error code.

Syntax

Err = errornumber

Argument
Description

errornumber

An integer between 1 and 32,767 representing an error code, or a 0 if no error occurs

Returns

Not applicable

Usage

The Err statement is used to send error information between procedures.

Example

This example generates an error code of 10000 and displays an error message if a user does not enter a customer name when prompted for it. It uses the Err statement to clear any previous error codes before running the loop the first time, and it also clears the error to allow the user to try again. For another example, read Error Statement.

Sub Button_Click
   Dim custname as String
   On Error Resume Next
   Do
      Err = 0
      custname = "Acme Inc."
      If custname = "" then
         Error 10000
      Else
         Exit Do
      End If
      Select Case Err
         Case 10000
            TheApplication.RaiseErrorText "You must enter a customer name."
         Case Else
            TheApplication.RaiseErrorText "Undetermined error. Try again."
      End Select
   Loop Until custname <> ""
      TheApplication.RaiseErrorText "The name is: " & custname
End Sub

Related Topics

Erl Function
Err Function
Error Function
Error Statement
On Error Statement
Resume Statement
Trappable Errors in Siebel VB

Siebel VB Language Reference Copyright © 2006, Oracle. All rights reserved.