The following, when used in a VBA sub will show the Team Captain(s) for a fund:
 
Public Sub fundTeamCaptains()
    Dim oFund As CFund
    Set oFund = New CFund
    
    Dim oTeams As CTeams
    Dim oTeam As CTeam
    
    Dim oRecord As CRecord
    Set oRecord = New CRecord
    
    With oFund
        .Init REApplication.SessionContext
        .Load 57 'Adjust to suit for specific fund
        
        Set oTeams = .Teams  'set the oTeams object from the fund
        
        If oTeams.Count > 0 Then 'ensure there are teams to work through
            For Each oTeam In oTeams
            
                With oTeam  'Dealing with a single team
                
                    If .Fields(TEAM_fld_CAPTAIN_ID) = "" Then 'Blank indicates no captains for team
                        Debug.Print "No captain for team: " & .Fields(TEAM_fld_TEAM_NAME)
                    Else
                        'We have a captain ID.  Use CRecord object for more detail
                        oRecord.Init REApplication.SessionContext
                        oRecord.Load .Fields(TEAM_fld_CAPTAIN_ID)
                        
                        Debug.Print .Fields(TEAM_fld_TEAM_NAME) & _
                            " Captain: " & oRecord.Fields(RECORDS_fld_FULL_NAME)
                        
                        oRecord.Closedown 'Ensure to close the CRecord object
                    End If
                    
                End With

            Next oTeam
        Else
            Debug.Print "No team(s) present"
        End If

        .Closedown 'Ensure to close the CFund object
    End With
    
    'Cleanup
    Set oFund = Nothing
    Set oRecord = Nothing
    Set oTeam = Nothing
    Set oTeams = 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.