Rank function in MS Access.

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.
 
T

Tim Ferguson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top