#error equals 0

mgui

Registered User.
Local time
Today, 07:39
Joined
Nov 18, 2017
Messages
10
I am creating a financial report in Access 2007. My report has a subreport. I am trying to pull subtotals from the subreport. Some of my fields from the subreport do not have any data, so I am receiving an #error in the text box. I need a code to turn the #error into 0. I currently have the following code in the text box =[Donations].[Report]![txtTotalsDonation Amount]

I have attached two screenshots of what I am doing.

Please help me get rid of #error and replace it with 0
 

Attachments

  • report.JPG
    report.JPG
    96.4 KB · Views: 151
  • code.jpg
    code.jpg
    101.1 KB · Views: 163
What is expression in txtTotalsDonationsAmount?

If you want to provide db for analysis, follow instructions at bottom of my post.
 
I do not know anything about writing code. I got the code I am using from a YouTube video. I need some to tell me the exact code to use.
 
Can try:

=IIf(IsError([Donations].[Report]![txtTotalsDonation Amount]), 0, [Donations].[Report]![txtTotalsDonation Amount])

Really need to find out why error occurs and fix code.
 
Last edited:
Some of my fields from the subreport do not have any data
If you are trying to add fields together and one of them is null you'll get null.
Null + anything is null. The solution is to wrap a null with the Nz Function which turns a null into the given value.

Code:
Nz(YourField,0)
 

Users who are viewing this thread

Back
Top Bottom