Full Version: Nothing Values in Reports
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
chrcal14
There may be no end to my suffering, I clear one hurdle and the next appears immediately.

I got my report to work by making different queries to extract data based on the varying criteria. Then I referenced each query in the control source of text boxes, along with a little bit of math to get the results I want to show.

Works great, except...

It fails wildly when any of the above mentioned fields return "nothing". I say nothing, because they don't return 0, they're just blank. And when they're blank, anything else that references them is also blank. If they have numbers in them, it works.

Example of the code I have in the control source...I tried to use an old Excel trick to get the field to display a 0 with an IIf statement, but that didn't work either...

CODE
=(DSum("[Sum of Volume]","Total Other Oil and Gas Query"))-(DSum("[Sum of Volume]","Total Atlas Query"))-(DSum("[Sum of Volume]","Total Range Query"))-(DSum("[Sum of Volume]","Total Phillips Query"))


I switched to this to try to get around the "Nothing" problem on the Report itself, I was just referencing the text boxes like this...

CODE
=((DSum("[Sum of Volume]","Total Other Oil and Gas Query"))-[Text0]-[Text4]-[Text6])


Again, this works either way, as long as none of the results of the DSum equations are "Nothing".

I guess that's a long way of asking...How do I force a 0 when the query returns "Nothing"?
tonympls
try

=nz((DSum("[Sum of Volume]","Total Other Oil and Gas Query")),0)-nz((DSum("[Sum of Volume]","Total Atlas Query")),0)-nz((DSum("[Sum of Volume]","Total Range Query")),0)-nz((DSum("[Sum of Volume]","Total Phillips Query")),0)
chrcal14
Nice!

Now that you put that here I looked up Nz, that's pretty handy.

Thanks so much!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.