Public Sub AddGift()
Dim oConstit As CRecord
Set oConstit = New CRecord
oConstit.Init REApplication.SessionContext
'System Record ID of Constituent
oConstit.Load 187
Dim ogift As CGift
Set ogift = New CGift
ogift.Init REApplication.SessionContext
With ogift
.Fields(GIFT_fld_Constit_ID) = oConstit.Fields(RECORDS_fld_ID)
.Fields(GIFT_fld_Type) = "Pledge"
.Fields(GIFT_fld_Date) = "2/28/2005"
.Fields(GIFT_fld_Amount) = 50
'Enter the Fund ID or Fund Description depending on the User option _
'selected for Funds.
'For annual recurrence use .Fields(GIFT_fld_Premium_Frequency)="Annually"
.Fields(GIFT_fld_Fund) = "2005 Annual Fund"
.Fields(GIFT_fld_Installment_Frequency) = "Monthly"
.Fields(GIFT_fld_Number_of_Installments) = 50
.Fields(GIFT_fld_Date_1st_Pay) = "2/28/2005"
'Day of the week the payment should be made
.Fields(GIFT_fld_Schedule_MonthlyDayOfWeek) = "Monday"
'Th Monthly Ordinal tells us the Second Monday of each month
'1 - First week, 2 - Second week, 3 - Third week, 4 - Fourth week , 5 - Last week
.Fields(GIFT_fld_Schedule_MonthlyOrdinal) = "2"
'The schedule spacing is 1 for every month. 2 would be every other month, ect.
.Fields(GIFT_fld_Schedule_Spacing) = 1
'Generate the schedule using the above information
.generateSchedule
'Save the pledge
.Save
End With
ogift.CloseDown
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. 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.