Public Sub GetAttendance()

   Dim oClassAtts As cEAClassAttendances

   Dim oClassAtt As cEAClassAttendance

   Dim oServices As FE_Services

   Dim oUtility As IBBUtilityCode

   Dim lSessionID As Long

   Dim lStudentID As Long

   Dim bHasDups As Boolean

   Dim oAttCode As cEAAttendanceCode

   Dim sAttCode As String

   Dim oClasses As cEAClasses

   Dim oClass As cEAClass

   Dim sClassName As String

   Dim sSQL As String


   Set oServices = New FE_Services

   oServices.Init FE_Application.SessionContext

   Set oUtility = oServices

   With oUtility

       'Will use SessionID and StudentId as filters for the attendance

       lSessionID = .eaSessionsGetSessionID("Regular", "Upper", "2004-2005", True)

       lStudentID = .eaRecordsGetRecordIDFromName(staticentry_PersonRecordType_StudentEA, "Andrews Michael", bHasDups:=bHasDups)

       If bHasDups Or lStudentID = 0 Then

           'Need to add code to handle the ID not being passed back or more

           'then one student matching the name

       End If

   End With

   Set oUtility = Nothing


   Set oServices = Nothing


   Set oClassAtts = New cEAClassAttendances

   oClassAtts.Init FE_Application.SessionContext

   'Filtering which attendance records to use

   oClassAtts.FilterObject.FilterProperties(EAATTENDANCEBYCLASS_FilterProp_Session) = lSessionID

   oClassAtts.FilterObject.FilterProperties(EAATTENDANCEBYCLASS_FilterProp_Student) = lStudentID


   'loop through all the attendance records for my filters

   For Each oClassAtt In oClassAtts

       With oClassAtt

           'Getting the Attendence code for this attendance entry

           Set oAttCode = New cEAAttendanceCode

           oAttCode.Init FE_Application.SessionContext


           sAttCode = oAttCode.Fields(EAATTENDANCECODES_fld_DESCRIPTION)


           Set oAttCode = Nothing


           'Getting the class and session associated with this attendance entry

           sSQL = "EA7CLASSES.EA7CLASSESID in " & _






           Set oClasses = New cEAClasses

           oClasses.Init FE_Application.SessionContext

           oClasses.FilterObject.CustomFilterProperty(CUSTOMFILTERTYPE_CUSTOMWHERE) = sSQL

           If oClasses.Count = 1 Then

               'should never get anything but one record in oClasses with this where clause

               Set oClass = oClasses.Item(1)

               sClassName = oClass.Fields(EACLASSES_fld_COURSE) & " - " & oClass.Fields(EACLASSES_fld_CLASSSECTION)


               Set oClass = Nothing

           End If


           Set oClasses = Nothing


           'Showing all the fields for the attendance entry in the immediate debug window

           Debug.Print .Fields(EAATTENDANCEBYCLASS_fld_ATTENDANCEDATE) & " - " & _


               " - " & sClassName & " - " & sAttCode


       End With

   Next oClassAtt

   Set oClassAtt = Nothing


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