Don't Display Zero Values on Report

Posted on 2003-03-19
Medium Priority
Last Modified: 2008-03-01
I have a report based on a query with calculated fields.  Is there a way not to display a zero value on the report?

QUERY - "sum: [Field1]+[Field2]" - If that equals 0, I don't want it to display on the overlying report.
Question by:dcurtis

Expert Comment

ID: 8165824
Use the format property of the text field on the report.

Example: $#,##0.00[Green];($#,##0.00)[Red];"Zero";"Null"
LVL 41

Expert Comment

ID: 8165867
Do you actually want to suppress the whole record, or just the field ?

If you want to suppress the record, just put a criteria of <>0 in the calculated field. If you want to hide only the field, you'll need code like this in the OnFormat event of that report section:
If Me!MyTextBox = 0 Then
   Me!MyTextBox.Visible = False
   Me!MyTextBox.Visible = True
End If

Where MyTextBox is the name of the text box containing the calculated field.

Accepted Solution

ACSPanama earned 500 total points
ID: 8166474
YES there is a couple of ways.
One way I do it is with an IIF statement:

IIF ([FiledName]=0,Null,[Field1]+[Field2])

If you use this method make sure that any other calculation on your form or in your query that uses this field has the Nz in fron of it so that if the field in the calculation is NULL then Access sets it to "0" for that calculation. Example: [Field1]+Nz([FieldName])

Anotherway is on your form do a "Conditional Format" for the field that could contain the "0" value.

To do this in Design View for your report Right click on the field that could contain the "0" value. Select "Conditional Format", Then Make a condition that sayes if value =0 then Set the Font Color to "White" or the same color as the background color of your report. The Zero will still tecnically still be there but you won't see it.

Author Comment

ID: 8171587
OK, setting a conditional format did the trick.  Thanks.  I knew you could do that in Excel, but was unaware it could be done in Access.  Thanks again.

Author Comment

ID: 8171588
OK, setting a conditional format did the trick.  Thanks.  I knew you could do that in Excel, but was unaware it could be done in Access.  Thanks again.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question