Public Sub OpenOriginalPledge(oRecord As IBBDataObject)

   Dim oPayment As CGift

   Dim oPledge As CGift

   Dim oGiftForm As CGiftForm


   If Not TypeOf oRecord Is CGift Then

       MsgBox "OpenOriginalPledge must only be run on a pledge payment"

       Exit Sub

   End If


   Set oPayment = oRecord

   If oPayment.Fields(GIFT_fld_Type) <> "Pay-Cash" Then

       MsgBox "OpenOriginalPledge must only be run on a pledge payment"

       Set oPayment = Nothing

       Exit Sub

   End If


   Set oGiftForm = New CGiftForm

   oGiftForm.Init REApplication.SessionContext


  'retrieve the pledge from the pledge payment

   Set oPledge = New CGift

   With oPledge

       .Init REApplication.SessionContext

       .Load oPayment.PledgePayer.PledgeId(1)

   End With


   'set the form to the pledge and show it

   Set oGiftForm.GiftObject = oPledge

   oGiftForm.ShowForm True


   'clean up


   Set oGiftForm = Nothing



   Set oPledge = Nothing

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