Private Sub AddAdjustment()



   Dim lGiftId As Long

   Dim oGift As CGift

   Dim oAdjustment As IBBAdjustment

   Dim oAdjustmentServer As CAdjustmentServer

   

   'Set the variable to the id of the original gift

   lGiftId = 762

   

   Set oGift = New CGift

   With oGift

       .Init REApplication.SessionContext

       'Load the original gift to be adjusted

       .Load lGiftId

   

       Set oAdjustmentServer = New CAdjustmentServer

       With oAdjustmentServer

           .Init REApplication.SessionContext, oGift

           Set oAdjustment = .AddAdjustment()

           

           With oAdjustment

               'let the user set fields on the adjustment

               .Fields(ADJUSTMENT_fld_Amount) = 98

               .Fields(ADJUSTMENT_fld_Fund) = "Natural Disaster Relief Fund"

           End With

           

           'Validate and save the adjustment

           .Validate

           .Save

       End With

       'clean up

       Set oAdjustmentServer = Nothing

       'Save and cleanup the gift object

       .Save

       .CloseDown

   End With



   Set oGift = Nothing

   

   Exit 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. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.