Public Sub AddEventAttribute()

   Dim oEvent As CSpecialEvent
   Set oEvent = New CSpecialEvent
   oEvent.Init REApplication.SessionContext
   Dim oAttribute As IBBAttribute

   'load a specific event from the sample database
   oEvent.Load 8

   Dim reService As REServices
   Set reService = New REServices
   reService.Init REApplication.SessionContext

   Dim oAttributeTypeServer As CAttributeTypeServer
   Set oAttributeTypeServer = reService.CreateServiceObject(bbsoAttributeTypeServer)

   oAttributeTypeServer.Init REApplication.SessionContext

   Dim lID As Long
   lID = oAttributeTypeServer.GetAttributeTypeID("Event Locale", bbAttributeRecordType_SPECIAL_EVENT)

   With oEvent.Attributes.Add
       .Fields(Attribute_fld_ATTRIBUTETYPES_ID) = lID
       .Fields(Attribute_fld_ATTRIBUTEDATE) = Date
       .Fields(Attribute_fld_VALUE) = "Blackbaud"
   End With

   'Save the parent object to save the attribute
   oEvent.Save
 
   'clean up
   reService.CloseDown
   Set reService = Nothing
   Set oAttribute = Nothing
   Set oAttributeTypeServer = Nothing
   oEvent.CloseDown
   Set oEvent = 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. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.