We are a group of users of Blackbaud products and are not affiliated with Blackbaud. We'd love to have you join our community to help and be helped in getting the most from your Blackbaud software.
Register now to join us to get independant advice on your system, connect with 3rd party consultants to help you maximize your database and have a real alternative to the official Blackbaud website.
Finding info for organization contacts in a VBA Macro
I am working on an export macro that pulls information on an organization's constituent contacts. The export selects the name of the contact on an action (I really wish the system id of the contact would be a field we could export) and I want to pull various bits of information for that contact in VBA.
For each organization I am looping through the CIndividuals2 class to find the desired contact (the one whose name matches the data in the export field contact name). What field in CIndividuals2 will give me the system record id of the contact?
CIndividuals2 has two fields that look promising - INDIVIDUAL2_fld_CONSTITUENT_ID and INDIVIDUAL2_fld_CONSTIT_ID
I believe that INDIVIDUAL2_fld_CONSTIT_ID is the id for the organization. However if I use INDIVIDUAL2_fld_CONSTITUENT_ID I get a User Interrupt error when I run the macro, but not if I use INDIVIDUAL2_fld_CONSTIT_ID.
I have not tested this but I am pretty sure that INDIVIDUAL2_fld_CONSTIT_ID is the system id and that INDIVIDUAL2_fld_CONSTITUENT_ID is the constituent id. You have to remember that some individuals in your CIndividuals2 collection are not going to be constituents and that the value for INDIVIDUAL2_fld_CONSTITUENT_ID will be blank in those cases. It could be that the error in your code is that you are not handling the blank values when they come in for the constituent id.
Feel free to contact me if you need any more help with this.