Private Sub RaisersEdgeRecord_BeforeSave(oRecord As Object, bCancel As Boolean)
   Dim oConstit As CRecord
   Set oConstit = oRecord
  
   Dim lID As Long
   lID = oConstit.Fields(RECORDS_fld_ID)
  
   Dim oOrgs As COrganizations2
   Set oOrgs = New COrganizations2
   oOrgs.Init REApplication.SessionContext, lID
  
   Dim oOrg As COrganization2
   Dim odataObject As IBBDataObject
  
   For Each oOrg In oOrgs
       Set odataObject = oOrg
       'following used to see what Org we are on
       Debug.Print oOrg.Fields(ORGANIZATION2_fld_NAME)
       oOrg.CloseDown
   Next oOrg
  
   oOrgs.CloseDown
   Set oOrgs = 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.