Remove Object Method
You can use the Remove Object method to remove from memory an object that Siebel VB instantiates in memory. If an object variable does not reference an object, then it contains a value of Nothing. The Remove Object method does not return a value.
Format
Set objectName = Nothing
The following table describes the arguments that you can use with this method.
Argument | Description |
---|---|
objectName |
The name of the object variable to set to Nothing. |
For example:
If Not objectVar Is Nothing then
objectVar.Close
Set objectVar = Nothing
End If
The following example adds an activity record when the user adds a contact record in a Siebel application. It presumes that the Contact business component is the parent business component. It instantiates the Action business component, and then uses the Remove Object method to remove this instance from memory after it finishes processing the business component data:
Sub BusComp_WriteRecord
Dim oBCact as BusComp
Set oBCact = theApplication.ActiveBusObject.GetBusComp("Action")
With oBCact
.NewRecord NewAfter
.SetFieldValue "Type", "Event"
.SetFieldValue "Description", "ADDED THRU SVB"
.SetFieldValue "Done", Format(Now(),"mm/dd/yyyy hh:mm:ss")
.SetFieldValue "Status", "Done"
.WriteRecord
End With
set oBCact = Nothing
End Sub
For other examples that use the Remove Object method, see Date and Time Methods and Get COM Object Method.