field sum

I want to total field values from a query and show the result under this column of field values in the report.
Each record lists the modules taken by a particular student and the appropriate fee for that module. I need to sum these per student.
Who is Participating?
DedushkaConnect With a Mentor Commented:
Hi rrraaa.
Assuming you have 2 tables:
tblStudent(StudentId, StudentName)
tblFee(StudentId, ModuleId, ModuleFee)

create and run this query:
SELECT First(tblStudent.StudentName) AS FirstOfStudentName, Sum(tblFee.ModuleFee) AS SumOfModuleFee
FROM tblStudent INNER JOIN tblFee ON tblStudent.StudentId = tblFee.StudentId
GROUP BY tblStudent.StudentId
ORDER BY First(tblStudent.StudentName);

Tested under Access2000.

rrraaaAuthor Commented:
Thankyou. I came in to delete the question as I posted after a while of frustatingly not being able to find out how. After posting the question I found that you can just sum a column in the report using the wizard. Boy did i feel dumb! lol. Anyways, the sql will never go astray so i'll give the points to you.
Thanks heaps!!
Hi rrraaa,
thanks for accepting my comment.

Have a nice day,
All Courses

From novice to tech pro — start learning today.