Has No Data

G

Guest

Hi

I have the following statement in my report:

=[Planned Budget] - Sum([Invoice)] - [dsum] +
IIf([tbl_Budget_revision].Report.HasData,
IIf([tbl_Budget_revision].Report!revision_operator="Add", 1,
-1) * [tbl_Budget_revision].Report!Revision_Amt, 0)

It works but when there is no data for [dsum] it doesn't process the rest of
the control, it comes out blank on my report. Is there anyway to still be
able to output the report total if there is no "dsum" amount?

Also, dsum is a text field calculation I created on my report. If it is
blank could I have it display $0.00.
 
K

Ken Snell [MVP]

Your first question: if dsum is Null, then the Null value is propogated
through the expression and your answer always will be Null. Use the Nz
function to trap for Null in dsum and replace it with a zero:

=[Planned Budget] - Sum([Invoice)] - Nz([dsum], 0) +
IIf([tbl_Budget_revision].Report.HasData,
IIf([tbl_Budget_revision].Report!revision_operator="Add", 1,
-1) * [tbl_Budget_revision].Report!Revision_Amt, 0)


Your second question: not knowing how you calculate the value that is to be
shown in dsum textbox, I can only generally state that yes, it probably is
possible to have it display "$0.00" if there is no value there (Null value,
most likely). But you'll need to tell us more about how and where you
calculate the value for that textbox. Chances are that the Nz function would
work there, too. However, note that, if you do change a Null into "$0.00" in
the dsum textbox, then the answer I gave you for the first question will no
longer work because dsum no longe will be Null in those circumstances... but
then, your original expression might work ok at that point.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top