Rank function in MS Access.

  • Thread starter Thread starter H S Yussof
  • Start date Start date
H

H S Yussof

In a spreadsheet there is a function of RANK to find the
position of students' marks. This function I can not used
in MS Access. Is there any other ways to find the student
position as it is in MS Excel function?

T. You.
 
Is there any other ways to find the student
position as it is in MS Excel function?

you look for the number of students that have grades higher than the
current one:

' create the criterion string
' for example: Grade < 40.6 AND Course = "LAW"
'
' note how to treat numerics and string values
'
strWhere = "Grade > " & Str(dblThisStudentsGrade) & _
" AND Course = " & """" & strThisStudentsCourse & """"

' DCount just counts the number of rows, so we can look up the
' grades table for the number of grades in the same course that
' scored higher
wPos = DCount("Grades", strWhere)

' now tell the user
MsgBox "You came in " & wPos & "th position!"



Hope that helps


Tim F
 
Back
Top