Private Sub AddSplitGift()



   Dim oGift As CGift

   Dim oConstituent As CRecord

   

   'Get constituent record of the donor

   Set oConstituent = New CRecord

   oConstituent.Init REApplication.SessionContext

   oConstituent.Load 280

   

   Set oGift = New CGift

   'Add a gift

   With oGift

       .Init REApplication.SessionContext

       'Prevent the default matching gifts to be added

       .OverrideDefaultMGCompanies = True

       .Fields(GIFT_fld_Constit_ID) = oConstituent.Fields(RECORDS_fld_ID)

       .Fields(GIFT_fld_Type) = "Cash"

       .Fields(GIFT_fld_Amount) = 200

       'Using the fund description.  This is dependent on user setting

       .Fields(GIFT_fld_Fund) = "2006 Annual Fund"

       .Splits.Item(1).Fields(GIFTSPLIT_fld_Amount) = 200 * 0.5

       'adding the split

       With .Splits.Add

           .Fields(GIFTSPLIT_fld_Fund) = "2005 Annual Fund"

           .Fields(GIFTSPLIT_fld_Amount) = 200 * 0.5

       End With

       .Save

       .CloseDown

   End With

   Set oGift = 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. 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.