Siebel VB Language Reference > VB Language Reference >

With Statement


This standard VB construct executes a series of statements on a specified variable.

Syntax

With variable
   statement_block
End With

Placeholder
Meaning

variable

The variable to be changed by the statements in statement_block

statement_block

The statements to execute on the variable

Returns

Not applicable

Usage

Variable can be an object or a user defined type. The With statements can be nested.

Example

This example uses a Siebel VB method to change values in an object when a specific field is successfully changed. With is used to refer to the object in which the values are changed. For another example, read Nothing Function.

Sub BusComp_SetFieldValue(FieldName As String)

   Select Case FieldName
      Case "Account Status"
      If Me.GetFieldValue(FieldName) = "Inactive" Then
         Dim oBCact as BusComp
         Dim sMessage as String
         Set oBCact = me.BusObject.GetBusComp("Action")
         sMessage = "ADDED THRU SVB: Account Status made Inactive"

         With oBCact
            .NewRecord NewAfter
            .SetFieldValue "Type", "Event"
            .SetFieldValue "Description", sMessage
            .SetFieldValue "Done", _
               Format(Now(),"mm/dd/yyyy hh:mm:ss")
            .SetFieldValue "Status", "Done"
            .WriteRecord
         End With

         set oBCact = Nothing
      End If
      End Select

End Sub

Related Topics

Type Statement

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