Siebel VB Language Reference > Methods Reference for Siebel VB > Error Handling Methods >

Set Error Code Method


The Set Error Code method sets a run-time error code. It does not return a value. You can use it to send error information between procedures.

Format

Err = errornumber

The following table describes the arguments that you can use with this method.

Argument
Description

errornumber

An integer in the range of 1 through 32,767 that identifies an error code, or a 0 if no error occurs.

Example

The following example creates an error code of 10000 and displays an error message if the user does not enter a customer name in reply to a prompt. It uses the Err statement to clear any previous error codes before it runs the loop for the first time. It also clears the error to allow the user to try again:

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

For another example, see Set Error Code Method.

Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.