Results 1 to 11 of 11
  1. #1
    felixkiprono402@gmail.com is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    8

    Post Dcount Function

    Hello.
    I have an ms Access 2010 Students database where I want to rank students based on semester and class. In my query I have [AdmNo],[TotamMarks], [Class], [Semester].
    I used the the function =DCOUNT("*","qryRank","TotalMarks>"[TotalMarks])+1. It works perfectly.


    But i want to add more criteria so that the rank is based on Class and Semester. So, how can i add the two criteria in the function above?

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Something like?

    Code:
    DCOUNT("*","qryRank","TotalMarks>" & [TotalMarks]+1, & " and [class] = '" & txtclassname & "')"
    Assuming the classname to search for will be from a textbox called txtclassname

  3. #3
    felixkiprono402@gmail.com is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    8
    Thanks Andy.
    the thing is; I want it do a grouped ranking (i.e. Same Class and Same Semester ranked together)
    Like:
    =Dcount("*", "qryRank", "TotalMarks>"&[TotalMarks] WHERE [ClassID] is same AND [Semester] is also same)
    something like that to return students list as below
    ADM NAME CLASS MARKS RANK SEMESTER
    100 JOHN FORM 1 600 1 TERM 1
    200 JANE FORM 1 500 2 TERM 1
    300 JOEL FORM 1 400 3 TERM 1
    400 JOYCE FORM 2 500 1 TERM 1
    500 JEAN FORM 2 100 2 TERM 1
    100 JOHN FORM 1 700 1 TERM 2
    200 JANE FORM 1 600 2 TERM 2
    300 JOEL FORM 1 200 3 TERM 2
    400 JOYCE FORM 2 500 1 TERM 2
    500 JEAN FORM 2 100 2 TERM 2

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Decount returns one value. You seem to be asking for the results of a query.

  5. #5
    felixkiprono402@gmail.com is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    8
    Andy, that's exactly what i am looking for. The value returned is RANK based on TotalMarks, Class and Semester at the same time. Please help me out of this. i want it in a way that it ranks students per class per semester according to marks scored by each. =DCount("*", "qryResults","TotalMarks>"&[TotalMarks] AND [Semester] is common AND [Class] is common)+ really waiting for any immediate help. thank you all

  6. #6
    felixkiprono402@gmail.com is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    8
    Andy, that's exactly what i am looking for. The value returned is RANK based on TotalMarks, Class and Semester at the same time. Please help me out of this. i want it in a way that it ranks students per class per semester according to marks scored by each. =DCount("*", "qryResults","TotalMarks>"&[TotalMarks] AND [Semester] is common AND [Class] is common)+ really waiting for any immediate help. thank you all

  7. #7
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Any chance of some data to play around with?

  8. #8
    felixkiprono402@gmail.com is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    8
    Click image for larger version. 

Name:	TheCurrentOutput.PNG 
Views:	9 
Size:	27.8 KB 
ID:	28818
    =Dcount("*","QryRank","CalcTotal>&[CalcTotal] WHERE [Termdate] is common AND [Class] is common)

  9. #9
    felixkiprono402@gmail.com is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    8
    Andy, Pliz help me out as soon as possible. Thanks.

  10. #10
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Felix you need a grouped query using queryrank as your start point. Group on term date and class

  11. #11
    felixkiprono402@gmail.com is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2017
    Posts
    8
    I ve tried that in vain. The Dcount() ranks all students even from different class and separate semester as a unit. I just want how to put those two other conditions right (i.e. to be of same class and same semester)
    How do i put the condition in the DCount()?
    Thanks for your advancement

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

Similar Threads

  1. Help with DCOUNT Function in Module
    By qcjustin in forum Access
    Replies: 9
    Last Post: 04-08-2015, 09:54 AM
  2. dcount function - new to Access VBA
    By jillp in forum Programming
    Replies: 7
    Last Post: 09-20-2012, 06:35 AM
  3. DCOUNT function with IN statement
    By dwilson in forum Access
    Replies: 2
    Last Post: 08-12-2011, 09:54 AM
  4. Using a date range with Dcount function
    By mleberso in forum Reports
    Replies: 4
    Last Post: 06-17-2011, 08:56 AM
  5. DCount function problem
    By 10 Gauge in forum Forms
    Replies: 5
    Last Post: 02-28-2011, 02:08 PM

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