Results 1 to 5 of 5
  1. #1
    macitaa is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    1

    how to position students rcords from a query

    Good day all,


    I have a student database for my school and i have a query with the students name, class, gender, total, average, all calculated.
    But i need to derive the position for the students either via total or average and i don't have a clue as to what function to use in getting the 1st, 2nd, 3rd, and so on position for a class of at least 30 students. I am migrating this database from Excel where i usually use the rank and lookup function to get the same, but i am at a dead end with ms access.

    Please i need all the help you can render or a referral to where this has been resolved before.
    Thanks to you.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Ranking in Access is not simple. Review: http://allenbrowne.com/ranking.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Have a look at this post of mine on another forum.
    https://www.access-programmers.co.uk...23&postcount=1

    It uses a function called Serialize to do ranking

    Although the methods on Allen browne's website work well, they can be difficult to setup e.g. Using subqueries
    I think using Serialize is easier

    EDIT I also used the same example in this recent post here
    https://www.accessforums.net/showthr...226#post382226
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Well, Allen does offer a VBA approach but it uses a 'temp' table.

    Calling custom function from query has its own drawbacks. Slow performance with large datasets is one possibility but then the same is true with nested subqueries and domain aggregate functions. I have used DCount() to create a row ID.

    However, looks like a very nice function.

    Just have to try each and see which works best.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    From experience, it's fast even with large datasets
    Faster than subqueries certainly.

    BTW I didn't write the function and can't remember the author's name
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 07-25-2016, 08:12 AM
  2. Replies: 10
    Last Post: 11-05-2015, 02:22 PM
  3. SQL query to select eligible students
    By Alex_738 in forum Queries
    Replies: 6
    Last Post: 06-03-2014, 12:48 PM
  4. Replies: 1
    Last Post: 10-02-2013, 04:54 PM
  5. Query showing only those students who have graduated
    By snowboarder234 in forum Queries
    Replies: 1
    Last Post: 07-26-2013, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums