Public Sub LoopStudentsByAttribute()



   Dim oStudents As cEAStudents

   Set oStudents = New cEAStudents

   

   Dim oStudent As cEAStudent

   

   Dim sWhere As String

   

   sWhere = "EA7RECORDSID = (SELECT EA7STUDENTS.EA7RECORDSID FROM EA7STUDENTS " & _

   "INNER JOIN EA7STUDENTATTRIBUTES ON EA7STUDENTS.EA7STUDENTSID = EA7STUDENTATTRIBUTES.PARENTID " & _

   "INNER JOIN EA7ATTRIBUTETYPES ON EA7STUDENTATTRIBUTES.ATTRIBUTETYPESID = EA7ATTRIBUTETYPES.ATTRIBUTETYPESID " & _

   "INNER JOIN TABLEENTRIES ON EA7STUDENTATTRIBUTES.TABLEENTRIESID = TABLEENTRIES.TABLEENTRIESID " & _

   "WHERE EA7ATTRIBUTETYPES.DESCRIPTION = 'Subject of Interest' and TABLEENTRIES.DESCRIPTION = 'History')"

   

   oStudents.Init FE_Application.SessionContext

   oStudents.FilterObject.CustomFilterProperty(CUSTOMFILTERTYPE_CUSTOMWHERE) = sWhere

   

   For Each oStudent In oStudents

       Debug.Print oStudent.Fields(EASTUDENTS_fld_FIRSTNAME) & " " & oStudent.Fields(EASTUDENTS_fld_LASTNAME)

       oStudent.CloseDown

   Next oStudent

   

   Set oStudent = Nothing

   

   oStudents.CloseDown

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