Public Sub TestDeleteAttribute()

Dim oStudent As cSBStudent

Dim oATS As CAttributeTypeServer

Dim oServices As FE_Services

Dim lAttributeID As Long

Dim lAttrCount As Long

Set oServices = New FE_Services

oServices.Init FE_Application.SessionContext


Set oATS = oServices.CreateServiceObject(bbsoAttributeTypeServer)

oATS.Init FE_Application.SessionContext, bbGlobalAttributeType_SBStudent

lAttributeID = oATS.GetAttributeTypeID("Student Type")



Set oATS = Nothing


Set oServices = Nothing


Set oStudent = New cSBStudent

oStudent.Init FE_Application.SessionContext

oStudent.Load 31


Dim lLoop As Long

lAttrCount = oStudent.Attributes.Count


For lLoop = lAttrCount To 1 Step -1

  If oStudent.Attributes.Item(lLoop).Fields(Attribute_fld_ATTRIBUTETYPESID) = lAttributeID Then

   oStudent.Attributes.Remove   oStudent.Attributes.Item(lLoop).Fields(Attribute_fld_ATTRIBUTESID)

  End If

Next lLoop




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