Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I sum a calculated column??

Status
Not open for further replies.

kingz2000

Programmer
May 28, 2002
304
DE
Hi Guys,

I have three columns in my table. In my report I have a 4th column which simply gives the total of the 3 via this formula:

=if(IsNull([txtBar_NL]);0;[txtBar_NL])+if(IstNull([txtBar_Kde]);0;[txtBar_Kde])+if(isnull([txtBar_Fern]);0;[txtBar_Fern])+if(isnull([txtBar_SWL]);0;[txtBar_SWL])

Now that works fine..However I now need the total of this sum(fourth column) to be displayed also. Since its not really a column from a table, I have problems using the function 'Sum' since it expects a column name to follow.
How do I tackle this problem?

Thanks in advance!!
 
I'm afraid it won't work at all as you've written it in your Q.

You could do:
=sum(iif(IsNull([txtBar_NL]);0;[txtBar_NL])+iif(IstNull([txtBar_Kde]);0;[txtBar_Kde])+iif(isnull([txtBar_Fern]);0;[txtBar_Fern])+iif(isnull([txtBar_SWL]);0;[txtBar_SWL]))

But you could make this shorter by using Nz().

=sum(nz([txtBar_NL],0)+nz([txtBar_Kde],0) +
nz([txtBar_Fern],0)+nz([txtBar_SWL],0))


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top