Public Sub OpenOrganizationForm()

   'opens the organization relationship form for the primary business

   Dim oConstit As CRecord

   Dim oOrgs As COrganizations2

   Dim lOrgID As Long

   Dim oOrgForm As CIndToOrg2Form


   'load the constituent who's org relationship you want to load

   Set oConstit = New CRecord

   oConstit.Init REApplication.SessionContext

   oConstit.Load 187


   'using orgs to grab the id for the primary organization

   Set oOrgs = New COrganizations2

   oOrgs.Init REApplication.SessionContext, 187, tvf_Org2_PrimaryBusiness

   If oOrgs.Count = 1 Then

       lOrgID = oOrgs.Item(1).Fields(ORGANIZATION2_fld_ID)

       Set oOrgForm = New CIndToOrg2Form

       oOrgForm.Init REApplication.SessionContext

       Set oOrgForm.ConstituentObject = oConstit

       oOrgForm.CurrentOrganizationID = lOrgID



       Set oOrgForm = Nothing

   End If



   Set oOrgs = Nothing



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