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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#Error is returned on sum([FieldName])



 
 
Thread Tools Display Modes
  #1  
Old October 27th, 2008, 05:36 PM posted to microsoft.public.access.reports
beh
external usenet poster
 
Posts: 2
Default #Error is returned on sum([FieldName])

I'm trying to get rid of the #Error on a sum field in an Access report. I've
tried =Sum(IIf(IsNull([CostDiff]),0,[CostDiff])) and the nz function to no
avail. It looks like to me like the reason that it is doing it is because
the quey is not returning any records. The query is right, there are no
records to return. I need the report to show 0 instead of #Error in this
instance. Any help is appreciated.
  #2  
Old October 27th, 2008, 05:55 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default #Error is returned on sum([FieldName])

Try:
=IIf([HasData] = -1, Sum([CostDiff]),0)

--
Duane Hookom
Microsoft Access MVP


"beh" wrote:

I'm trying to get rid of the #Error on a sum field in an Access report. I've
tried =Sum(IIf(IsNull([CostDiff]),0,[CostDiff])) and the nz function to no
avail. It looks like to me like the reason that it is doing it is because
the quey is not returning any records. The query is right, there are no
records to return. I need the report to show 0 instead of #Error in this
instance. Any help is appreciated.

  #3  
Old October 27th, 2008, 06:08 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default #Error is returned on sum([FieldName])

beh wrote:

I'm trying to get rid of the #Error on a sum field in an Access report. I've
tried =Sum(IIf(IsNull([CostDiff]),0,[CostDiff])) and the nz function to no
avail. It looks like to me like the reason that it is doing it is because
the quey is not returning any records. The query is right, there are no
records to return. I need the report to show 0 instead of #Error in this
instance.


It seems to me that a report with no records is not going to
be very useful ;-)

Maybe your report is more complex than you have stated in
your question? If the Sum is in a subreport, then you
should read up on the HasData property in VBA Help and
provide more details in a follow up question.

--
Marsh
MVP [MS Access]
  #4  
Old October 27th, 2008, 06:18 PM posted to microsoft.public.access.reports
beh
external usenet poster
 
Posts: 2
Default #Error is returned on sum([FieldName])

Thank you. That worked. I've never seen the hasdata before.

"Duane Hookom" wrote:

Try:
=IIf([HasData] = -1, Sum([CostDiff]),0)

--
Duane Hookom
Microsoft Access MVP


"beh" wrote:

I'm trying to get rid of the #Error on a sum field in an Access report. I've
tried =Sum(IIf(IsNull([CostDiff]),0,[CostDiff])) and the nz function to no
avail. It looks like to me like the reason that it is doing it is because
the quey is not returning any records. The query is right, there are no
records to return. I need the report to show 0 instead of #Error in this
instance. Any help is appreciated.

 




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 10:09 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.