dbTalk Databases Forums  

Sum function fails in some records

comp.databases.ms-access comp.databases.ms-access


Discuss Sum function fails in some records in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tomahawk Lady
 
Posts: n/a

Default Sum function fails in some records - 03-30-2009 , 12:44 PM






I'm building a new database in 2007. Fields include monthly values
for Social Security, Wages, Pension, Other -- all set up as currency
fields. In my form, I want to total those values to get total monthly
income. I've got 3 sample records. In one of the records, the sum
function works perfectly. In two of the records, nothing appears in
the total field despite values in some (or all) of the input fields.
The sum function also fails when I write a query, i.e. it works in one
of the records but not in the other two. I've compacted and
repaired. Can anyone guess what's up?

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Sum function fails in some records - 03-30-2009 , 03:33 PM






Tomahawk Lady wrote:
Quote:
I'm building a new database in 2007. Fields include monthly values
for Social Security, Wages, Pension, Other -- all set up as currency
fields. In my form, I want to total those values to get total monthly
income. I've got 3 sample records. In one of the records, the sum
function works perfectly. In two of the records, nothing appears in
the total field despite values in some (or all) of the input fields.
The sum function also fails when I write a query, i.e. it works in one
of the records but not in the other two. I've compacted and
repaired. Can anyone guess what's up?
No idea what your formula is for adding the fields together. No idea
hoq you call the formul. No idea if its a calculated (should be) or if
it's stored somerwhere (why?). You might want to look at the NZ()
function. Who knows, you may be attempting to add a value to a null.





Reply With Quote
  #3  
Old   
Bob Quintal
 
Posts: n/a

Default Re: Sum function fails in some records - 03-30-2009 , 05:13 PM



Tomahawk Lady <nancycmarshall (AT) verizon (DOT) net> wrote in
news:6a2d5066-38fa-4a35-b92c-4ca1274a2b5d (AT) z1g2000yqn (DOT) googlegroups.com
:

Quote:
I'm building a new database in 2007. Fields include monthly
values for Social Security, Wages, Pension, Other -- all set up as
currency fields. In my form, I want to total those values to get
total monthly income. I've got 3 sample records. In one of the
records, the sum function works perfectly. In two of the records,
nothing appears in the total field despite values in some (or all)
of the input fields. The sum function also fails when I write a
query, i.e. it works in one of the records but not in the other
two. I've compacted and repaired. Can anyone guess what's up?
If any field value is NULL or contains text, even a space,, the
calculation will be aborted snd no result displayed.

Replace all empty fields with a 0.
If that works, and it should, modify the table so that each field in
the calculation has a default value of 0.

Or you can modify the calculation to replace each reference to aField
with NZ([aField],0)

--
Bob Quintal

PA is y I've altered my email address.


Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.