In the following screenshot, you will see a table named
The completed totals query named
In the table in the preceding screenshot, I have student codes thatare repeated more than once, depending on the numbers of payments thathave been received. If you look at
So, how did I manage to sum the amount received so quicklyusing a query? Let’s run through the steps:
- Usingthe SSGSchool.accdb database,create a new query in DesignView.
- Add the two tables (
StudentsTbl and FeeAccountsTbl) to the query grid.
- Add the
Code and Surname fields fromthe StudentsTbl table andthe AMT_RECEIVED field fromthe FeeAccountsTbl table to thedesign grid.
- From the
Show/Hide group, selectthe Totals icon.
- On the query grid, check that the
Total: rowreads GroupBy for the Surname field and thatthe AMT_RECEIVED field performsthe Sum function,as illustrated in the following screenshot:
- Run your query using the
Run icon on the ribbon. Yourquery should group the surnames and give the total amount received foreach student code.