A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

sum function on forms in access



 
 
Thread Tools Display Modes
  #1  
Old September 5th, 2005, 09:58 PM
newbee
external usenet poster
 
Posts: n/a
Default sum function on forms in access

I'm using access 2003. i've created a form for recording monthly donations
which includes 12 field for Jan - Dec. I want a box or field for
'year-to-date' to have a running total of donations for each donor. it seems
easy enough -....
my thought was =sum([jan]+[feb]+[mar]...) so forth.... this doesn't seem to
work. where am i going wrong?
ps - I am a newbee - bear that in mind - THANKS!

Newbee.
  #3  
Old September 5th, 2005, 11:57 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Mon, 5 Sep 2005 13:58:06 -0700, newbee
wrote:

I'm using access 2003. i've created a form for recording monthly donations
which includes 12 field for Jan - Dec.


Then your table is incorrectly designed. What will you do next
January? Scrap your database and start over?

You have a one (donor) to many (donations) relationship. The proper
way to manage a one to many relationship is with TWO tables, e.g.:

Donors
DonorID
LastName
FirstName
other bio information

Donations
DonorID same datatype as DonorID, Long Integer if that's an
Autonumber
DonationDate
Amount

You'ld add a new RECORD (using a Subform) into Donations for each
donation from the donor.

I want a box or field for
'year-to-date' to have a running total of donations for each donor. it seems
easy enough -....
my thought was =sum([jan]+[feb]+[mar]...) so forth.... this doesn't seem to
work. where am i going wrong?
ps - I am a newbee - bear that in mind - THANKS!


The Sum() function sums values in the SAME field across MULTIPLE
records. If you just want to add up the values in your non-normalized
monthname fields, you need to allow for the possibility that one might
be blank (NULL); any expression involving NULL returns NULL. The
getaround is to use the NZ (Null To Zero) function:

=NZ([Jan]) + NZ([Feb]) + NZ([Mar]) + ...

With the normalized table structure, with one record per donation, you
can indeed use the Sum() function; in your subform's Footer put a
textbox with COntrol Source

=Sum([Amount])


John W. Vinson[MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2002 vs 2003 Patrick Stubbin General Discussion 2 May 17th, 2005 07:27 AM
The "Right" web hosting for data access pages?? Ron Ehrlich General Discussion 9 May 6th, 2005 05:49 AM
Encrypt AccesS File? milest General Discussion 2 February 9th, 2005 07:58 PM
Access Error Message when opening database eah General Discussion 3 January 26th, 2005 10:04 AM
Access XP Compared to Access 2003 Mardene Leahu New Users 1 October 1st, 2004 05:11 AM


All times are GMT +1. The time now is 08:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.