Public Sub AddParticipantFee()

Dim oParticipant As CParticipant

Set oParticipant = New CParticipant

oParticipant.Init REApplication.SessionContext

oParticipant.Load 144

With oParticipant

  Dim lEventID As Long

  Dim lPriceID As Long

  'Get the Event ID to later get the Price Information

  lEventID = .Fields(Participants_fld_EventID)

  'Load the Event

  Dim oEvent As CSpecialEvent

  Set oEvent = New CSpecialEvent

  oEvent.Init REApplication.SessionContext


  oEvent.Load lEventID


  Dim oprice As CEventPrice

  'Get the Event Price ID for the Unit needed

  For Each oprice In oEvent.Prices

      If oprice.Fields(EventPrices_fld_Unit) = "Single" Then

          lPriceID = oprice.Fields(EventPrices_fld_ID)

      End If

  Next oprice

  'Closedown Event


  Set oEvent = Nothing

  Set oprice = Nothing



   With oParticipant.Fees.Add

       .Fields(ParticipantFees_fld_EventPricesID) = lPriceID

       .Fields(ParticipantFees_fld_NumUnits) = 1

       .Fields(ParticipantFees_fld_GiftAmount) = 100

   End With


End With

'Save the participant


'clean up


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