Welcome to Forums Sign in | Join | Help | Forums
in Search


RollbackTransaction for a recurring gift

Last post 03-01-2007 8:26 PM by David Wanless. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-01-2007 8:26 PM

    RollbackTransaction for a recurring gift

    Does anyone know how to use VBA to roll back the date of a recurring gift record? The most likely looking way of doing this is the RollbackTransaction method for a CGift record but it gives an error: Run-time error '-2147219866 (80040666)' Object variable or With block variable not set. The objGift.Fields(GIFT_fld_NextTransactionDate) field is read-only. We can't find any documentation on what the objGift.NextRecurringTransactionDate function is supposed to do, but can't make it change the date. Here's our code. What are we doing wrong? By the way, replacing the objGift.RollbackTransaction with an objGift.SkipNextTransaction does indeed skip a transaction. Public Function RollbackTransaction(lngConstituentID As Long) ' ' Author: David Wanless ' Date Created: 2/3/07 ' Request Tracker: ' Purpose: Roll back transaction for a given constituent ' Reviewed By: ' Review Date: ' Dim blnReturnValue As Boolean Dim intRecordCount As Integer Dim intGiftCount As Integer Dim intFieldCount As Integer Dim intTableId As Integer Dim intEntryId As Integer Dim lngGiftId As Long Dim objConstituent As New CRecord Dim objConstituentRG As New CRecord Dim objGift As New CGift objConstituent.Init REApplication.SessionContext objConstituent.LoadByField uf_Record_CONSTITUENT_ID, lngConstituentID intRecordCount = 0 blnReturnValue = False intRecordCount = intRecordCount + 1 If objConstituent.Gifts.Count > 0 Then objGift.Init REApplication.SessionContext lngGiftId = 0 For Each objGift In objConstituent.Gifts If objGift.Fields(GIFT_fld_Type) = "Recurring Gift" Then lngGiftId = objGift.Fields(GIFT_fld_ID) ' objGift.Fields(GIFT_fld_NextTransactionDate) = CDate("28/02/2007") ' objGift.NextRecurringTransactionDate( - don't know what this does objGift.RollbackTransaction objGift.Fields(GIFT_fld_Reference) = "Rolled back by VBA on " & Format(Date, "dd/mm/yyyy") objGift.Save objGift.CloseDown objGift = Nothing blnReturnValue = True End If Next objGift End If objConstituent.CloseDown Set objConstituent = Nothing RollbackTransaction = blnReturnValue End Function
Page 1 of 1 (1 items)