Public Sub ChangeBusiness()

Dim oOrg As COrganization2
Set oOrg = New COrganization2
oOrg.Init REApplication.SessionContext

'load Robert Hernandez business relationship
oOrg.Load 112

If oOrg.Fields(ORGANIZATION2_fld_IS_PRIMARY) = True Then

   oOrg.Fields(ORGANIZATION2_fld_IS_PRIMARY) = False

End If

oOrg.Save

Dim oOrg2 As COrganization2
Set oOrg2 = New COrganization2
oOrg2.Init REApplication.SessionContext

With oOrg2

   'Set new relationship to constituent
   .Fields(ORGANIZATION2_fld_CONSTIT_ID) = oOrg.Fields(ORGANIZATION2_fld_CONSTIT_ID)
   .Fields(ORGANIZATION2_fld_NAME) = "Blackbaud"
   .Fields(ORGANIZATION2_fld_IS_PRIMARY) = True
   .Fields(ORGANIZATION2_fld_IS_EMPLOYEE) = True

End With

With oOrg2.Address
   .Fields(CONSTIT_ADDRESS_fld_ADDRESS_BLOCK) = "2000 Daniel Island Drive"
   .Fields(CONSTIT_ADDRESS_fld_CITY) = "Charleston"
   .Fields(CONSTIT_ADDRESS_fld_STATE) = "SC"
End With

'Cleanup
oOrg2.Save
oOrg.CloseDown
Set oOrg = Nothing
oOrg2.CloseDown
Set oOrg2 = 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.