Notices


Reply
 
LinkBack Thread Tools Display Modes

Old 03-01-2007, 07:30 PM   #1 (permalink)
Junior Member

Join Date: Oct 2006
Posts: 7
Rep Power: 0 dwanless is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- API/VBA

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.

Thanks in advance for any help,

David Wanless
The Wilderness Society (Australia)
david dot wanless at wilderness dot org dot au

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old 03-02-2007, 06:53 AM   #2 (permalink)
Likes to customize RE!

DavidZ's Avatar

Join Date: Jul 2006
Location: London, UK
Posts: 335
Rep Power: 3 DavidZ is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- API/VBA

Haven't really had the time to look through your code properly but the line:

objGift.NextRecurringTransactionDate

gets the next recuring transaction date after the date that you supply. If you supply the previous date it will simply give you the same date back so you have to supply the date plus one day. However this method is pointless if all you want is the next scheduled transaction date as it is stored in the gift.

objGift.Fields(GIFT_fld_NextTransactionDate)

By the looks of things you are trying to rollback a transaction that is not the latest one. Only the latest transaction can be rolled back (that is how it is in the GUI)

David
__________________
David Zeidman
Zeidman Development
http://www.zeidman.info

Check out my RE API blog
http://www.re-decoded.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

Old 03-02-2007, 03:52 PM   #3 (permalink)
Junior Member

Join Date: Oct 2006
Posts: 7
Rep Power: 0 dwanless is on a distinguished road

Blackbaud Products
- Raiser's Edge (RE)
- API/VBA

Dear David,

Thanks for that. At least I now know what objGift.NextRecurringTransactionDate does.

However, the fundamental problem was that objGift.RollbackTransaction doesn't work. All we want to do is roll back the most recent transaction, but we get the error quoted when we try. Have you (or any other readers) ever managed to get RollbackTransaction to work?

Those two commented lines about objGift.NextRecurringTransactionDate and objGift.NextRecurringTransactionDate were only in there because I was exploring alternatives when I couldn't get RollbackTransaction to work.

Regards,

David.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
error, gift, howto, transaction, vba


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Cheap Gas - Loans - Mortgage - Loans
All times are GMT -6. The time now is 02:43 AM.

Miscellaneous


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by BBpixel Team 2008 :: jvbPlugin R1012.364.1

SEO by vBSEO 3.2.0 Copyright 2008 Blackbaud User SocietyAd Management by RedTyger
Inactive Reminders By Icora Web Design

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64