Public Sub LoopAssets()

   Dim oGift As CGift
   Set oGift = New CGift
   oGift.Init REApplication.SessionContext
  
   oGift.Load 1419
   'the Asset property is in the IBBGift2 interface
   Dim oGift2 As IBBGift2
  
   Dim oGiftAssets As CGiftAssets
  
   Set oGift2 = oGift
   Set oGiftAssets = oGift2.Assets
  
   Dim oAsset As CGiftAsset
   Dim lID As Long
  
   For Each oAsset In oGiftAssets
       If oAsset.Fields(GIFTASSET_fld_Amount) = 500 Then
           oGiftAssets.Remove oAsset
       ElseIf oAsset.Fields(GIFTASSET_fld_Amount) = 150 Then
           oAsset.Fields(GIFTASSET_fld_Description) = "This is a $150 asset"
       End If
   Next oAsset
  
   oGift.Save
  
   Set oGiftAssets = Nothing
   Set oAsset = Nothing
  
   oGift.CloseDown
   Set oGift = Nothing
  
   Set oGift2 = Nothing

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.