Public Sub MajorCount()
    Dim oEdus As CEducations2
    Set oEdus = New CEducations2
   
    Dim sSQL As String
   
    sSQL = "EDUCATION.ID in (select M.PARENTID from EDUCATIONMAJOR M "
    sSQL = sSQL & "join EDUCATION E on E.ID = M.PARENTID "
    sSQL = sSQL & "where E.DEGREE = 35 and M.TABLEENTRIESID = 971)"
   
    oEdus.Init REApplication.SessionContext, , tvf_Edu2_CustomWhereClause, sSQL
   
    Debug.Print oEdus.Count
   
    oEdus.Closedown
    Set oEdus = Nothing


End Sub

Within the custom where clause in the above example 35 is the TABLEENTRIESID of "BS" and 971 is the TABLEENTRIESID of "Biology".

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 solutions@blackbaud.com.