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  

How to total calculated fields



 
 
Thread Tools Display Modes
  #1  
Old December 28th, 2007, 06:08 PM posted to microsoft.public.access.forms
Dave
external usenet poster
 
Posts: 218
Default How to total calculated fields

I am calculating my "Line" total like this:

=IIf([ChargeDays]="","",[ChargeDays]*[PerDiemRate])
in a field called "txtTotal"

To get a total of line items I have tried these:

=Sum([txtTotal])
=Sum([ChargeDays]*[PerDiemRate])
=Sum(([ChargeDays]*[PerDiemRate]))
=sum((IIf([ChargeDays]="","",[ChargeDays]*[PerDiemRate])))

all if these give me "#error"
regardless if the list is filtered or not filtered

Any help here will be appreciated.

Thanks in advance

  #2  
Old December 28th, 2007, 06:40 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default How to total calculated fields

It is hard to sum text.

Try this ---
=sum((IIf([ChargeDays]=Null,0,[ChargeDays]*[PerDiemRate])))
OR
=sum((IIf([ChargeDays]=0,0,[ChargeDays]*[PerDiemRate])))
based on whether you have nulls or blanks.
--
KARL DEWEY
Build a little - Test a little


"Dave" wrote:

I am calculating my "Line" total like this:

=IIf([ChargeDays]="","",[ChargeDays]*[PerDiemRate])
in a field called "txtTotal"

To get a total of line items I have tried these:

=Sum([txtTotal])
=Sum([ChargeDays]*[PerDiemRate])
=Sum(([ChargeDays]*[PerDiemRate]))
=sum((IIf([ChargeDays]="","",[ChargeDays]*[PerDiemRate])))

all if these give me "#error"
regardless if the list is filtered or not filtered

Any help here will be appreciated.

Thanks in advance

  #3  
Old December 28th, 2007, 07:26 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default How to total calculated fields

Slight correction. If ChargeDays can be Null, you'd want

=Sum(IIf(IsNull([ChargeDays]),0,[ChargeDays]*[PerDiemRate]))

or

=Sum(Nz([ChargeDays], 0)*[PerDiemRate])

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"KARL DEWEY" wrote in message
...
It is hard to sum text.

Try this ---
=sum((IIf([ChargeDays]=Null,0,[ChargeDays]*[PerDiemRate])))
OR
=sum((IIf([ChargeDays]=0,0,[ChargeDays]*[PerDiemRate])))
based on whether you have nulls or blanks.
--
KARL DEWEY
Build a little - Test a little


"Dave" wrote:

I am calculating my "Line" total like this:

=IIf([ChargeDays]="","",[ChargeDays]*[PerDiemRate])
in a field called "txtTotal"

To get a total of line items I have tried these:

=Sum([txtTotal])
=Sum([ChargeDays]*[PerDiemRate])
=Sum(([ChargeDays]*[PerDiemRate]))
=sum((IIf([ChargeDays]="","",[ChargeDays]*[PerDiemRate])))

all if these give me "#error"
regardless if the list is filtered or not filtered

Any help here will be appreciated.

Thanks in advance



  #4  
Old December 28th, 2007, 10:15 PM posted to microsoft.public.access.forms
Dave
external usenet poster
 
Posts: 218
Default How to total calculated fields

None of either of your suggestions worked.
Am I doing something else wrong?

dave

"Dave" dave@accessdatapros wrote in message
...
I am calculating my "Line" total like this:

=IIf([ChargeDays]="","",[ChargeDays]*[PerDiemRate])
in a field called "txtTotal"

To get a total of line items I have tried these:

=Sum([txtTotal])
=Sum([ChargeDays]*[PerDiemRate])
=Sum(([ChargeDays]*[PerDiemRate]))
=sum((IIf([ChargeDays]="","",[ChargeDays]*[PerDiemRate])))

all if these give me "#error"
regardless if the list is filtered or not filtered

Any help here will be appreciated.

Thanks in advance


  #5  
Old December 28th, 2007, 10:56 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default How to total calculated fields

On Fri, 28 Dec 2007 14:15:25 -0800, "Dave" dave@accessdatapros wrote:

None of either of your suggestions worked.
Am I doing something else wrong?


Presumably. What are you doing? I can't see it from here.

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


All times are GMT +1. The time now is 04:25 PM.


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