Private Sub ConstitMemberFind()

    Dim oRecords As CRecords
    Dim oRecord As CRecord
    Set oRecords = New CRecords

    oRecords.Init REApplication.SessionContext
    Dim oMember As CMembership
    For Each oRecord In oRecords
        'Conditional code can be changed here for search purposes..._
        'You will need to add string parsing in to compare the text values_
        'passed in with that of fields on the constituent record.
        If oRecord.Fields(RECORDS_fld_FIRST_NAME) = "Bob" Then
            MsgBox "I've found Bob!", vbOKOnly, "Success"
            If oRecord.Memberships.Count <> 0 Then
                MsgBox "Memberships found for Bob", vbOKOnly, "Membership"
                    For Each oMember In oRecord.Memberships
                        Debug.Print oMember.Fields(MEMBERSHIP_fld_Description)
                        Debug.Print oMember.Fields(MEMBERSHIP_fld_CurrentCategory)
                        Debug.Print ""
                    Next oMember
                    Set oMember = Nothing
            End If
        End If
    Next oRecord

    Set oRecord = Nothing

    Set oRecords = Nothing

End Sub

Blackbaud provides 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 that you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures.  Blackbaud Customer Support can help explain the functionality of a particular procedure but they will not modify, or assist you with modifying, these examples to provide additional functionality.  If you are interested in learning more about VBA and API modules, contact our Sales department at