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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 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