Public Sub UpdateTributeFields()

   Dim oRecord As CRecord

   Dim oTribute As CTribute

   Dim oTributeAck As CTributeAcknowledgee

   Dim bFound As Boolean


   'Opening the constituent record that has the tribute

   Set oRecord = New CRecord

   oRecord.Init REApplication.SessionContext


   oRecord.Load 744


   'looping through tributes to find the one needing updating

   For Each oTribute In oRecord.Tributes

       If oTribute.Fields(Tribute_fld_ID) = 21 Then

           'Check the "Gifts may be given to this tribute" field

           'if not already checked

           If oTribute.Fields(Tribute_fld_ACTIVE) <> True Then

               oTribute.Fields(Tribute_fld_ACTIVE) = True

           End If


           'Need to determine if the "Honor/Memorial is an acknowledgee"

           'is already checked

           bFound = False

           For Each oTributeAck In oTribute.Acknowledgees

               If oTributeAck.Fields(TributeAcknowledgee_fld_RELATIONSHIPS_ID) = "" Then

                   bFound = True

                   Exit For

               End If

           Next oTributeAck

           'if not already checked then check the

           '"Honor/Memorial is an acknowledgee" field

           If bFound = False Then

               With oTribute.Acknowledgees.Add

                   .Fields(TributeAcknowledgee_fld_RELATIONSHIPS_ID) = ""

               End With

           End If

       End If

   Next oTribute




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