I was wondering if someone would be kind enough to explain to me why does this statement returns -1:
The query used in the recordset is:
Select * From TakenExams Where CourseId = '1' and StudentNumber = '841010321'
I checked the table and there are at least 10 records that match the aforementioned query, so I do not know what is causing this error. So, in order to get the total of records that match this query I have to run a loop:
recordset.CursorType = adOpenDynamic
While recordset.EOF = False Then
if recordset("CourseId").Value = "1" _
And recordset("StudentNumber").Value = "841010321" Then
totalRecs = totalRecs + 1
I had to store a specific value from the Exams table in a dynamic array, so after I run this loop I had to run another one:
ReDim examGrade(totalRecs) as Single
For i = 1 to totalRecs
examGrade(i) = recordset("Value").value
I would really like some help to optimize this code, because even though it is working, it has to be done in some other way.