Does the IDE generate receipt numbers when a gift is created?

When a gift is created, receipt numbers are generated. These are automatically generated within the application and the API can be used to obtain the next available receipt number. This solution contains an example in code to retrieve this number.
The API has no built-in function to generate receipt numbers.  The following VBA/VB6 code can be used to obtain the largest number:

Public Sub GreatestRecieptNumber()
    Dim lGreatestReceiptNumber As Long
    Dim oGifts As CGifts
    Set oGifts = New CGifts
    Dim oGift As CGift
    With oGifts
        .Init REApplication.SessionContext
        .SortField = GIFT_fld_Receipt_Number
        .SortOrder = Descending
        Set oGift = .Item(1)
    End With

    lGreatestReceiptNumber = oGift.Fields(GIFT_fld_Receipt_Number)
    Debug.Print lGreatestReceiptNumber 'prints the largest receipt number
    Set oGift = Nothing
    Set oGifts = 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.



Was this article helpful?

Thanks for your feedback! Did this solve your issue?

Comments (optional):

Thanks for your feedback!
We're glad it was helpful but sorry it didn’t solve your issue. If you need assistance, click Chat with Support below.
We’re sorry to hear that. Please tell us why.

 I don't like how this works.

 The answer is confusing.

 The answer didn't match what I was searching for.

Additional Comments (optional):

Thanks for your feedback! If you need assistance, click Chat with Support below.
Thanks for your feedback. Help us make our products even better by sharing details in our Idea Banks or our online Community.
Thanks for letting us know. We'll work on clarifying the information in the article. If you need assistance, click Chat with Support below.
Thanks for letting us know. We'll work on updating the search engine to return more relevant results.