Full Version: Starting out with sum calculations
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Goldenfool
Hi all!

My database has a table which tracks donations made by supporters of the charity I work for. I have a supporters table with a one to many relationship to a donations table, and I'm trying to work out how to display a "total donations to date" control in my Supporters form, which will sum all of the donations made for that supporter in the donations subform.

Would love some pointers as to where to start! I'm sure it's very simple, but I can't quite wrap my brain around it, no matter how much reading I do.

Cheers,
Charlotte
Peter46
Use an unbound textbox and use an expression like this as the control source:

=DSum("DonationValue", "TheTableName", "Supporterid = '" & forms!thisformname!txtSupporterid & "'")

This assumes that the control which holds the supporterid is called txtsupporterid and that supporterid (or whatever your field is called) is text.
If supporterid is number then use : ...."Supporterid = " & forms!thisformname!txtSupporterid )

Obviously you need to use your own table and field names.
sameed
Have look this Post

Sameed
Goldenfool
Thanks Sameed, just what I needed! Can't beleive I didn't think of it, you're a star!
sameed
Welcome,

Glad to help you.

Sameed
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.