Calculating GPA in Access 2010

Posted on 2012-08-24
Last Modified: 2012-08-24
Can you help me create a query that calculates current overall GPA?

The database is for only one student.  It contains two tables (screenshot attached)

(GPA is calculated by dividing the total amount of grade points earned by the total amount of credit hours attempted. Grade point average may range from 0.0 to a 4.0. An A earns 4 points, a B earns 3, a C= 2, a D 1 and an F 0.  A W earns no points but indicates that the semester hours for that course should not be counted in the hours attempted total.)

This is my scratch work so far...but I don't know what else to do with it or what else to try...

[[[ SUM DegreeRequirements.SemesterHours where CompletedCourses.Grade <> W AND  DegreeRequirements.CourseCode = CompletedCourses.CourseCode

SUM GradePoints,

GradePoints:  [CreditHours] * Nz(Switch([LetterGrade] = "A", 4, [LetterGrade] = "B",
3, [LetterGrade] = "C", 2, [LetterGrade] = "D", 1, [LetterGrade] = "F", 0),

GPA: SUM GradePoins / SUM DegreeRequirements.SemesterHours ]]]

(I love Access, I don't know why I always get so tangled up with it :-( )
Question by:fabi2004
    1 Comment
    LVL 1

    Accepted Solution

    I figured it out.

    SELECT Sum([tblDegreeRequirements].[SemesterHours]*Nz(Switch([tblCompletedCourses].[Grade]="A",4,[tblCompletedCourses].[Grade]="B",3,[tblCompletedCourses].[Grade]="C",2,[tblCompletedCourses].[Grade]="D",1,[tblCompletedCourses].[Grade]="F",0,[tblCompletedCourses].[Grade]="W",0),0)) AS GradePoints, Sum(tblDegreeRequirements.SemesterHours) AS Credits, [GradePoints]/Credits AS GPA
    FROM tblDegreeRequirements INNER JOIN tblCompletedCourses ON tblDegreeRequirements.CourseCode = tblCompletedCourses.CourseCode
    HAVING (([tblCompletedCourses].[Grade]<>"W"));

    Then I adjust the properties of the GPA field to Format=fixed and Decimal=2
    I get a couple of sums I hadn't thought about showing, but it doesn't hurt for them to show up.  So I'm all good.  

    Thanks anyways.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now