Making a text rows in report dissapear

Posted on 2010-01-05
Last Modified: 2013-11-28

I have a number of rows with text in the report (see example in attached image).  What I need is for them to display when the numerical / date value is not zero and equally not display at all when the numerical values are zero.  This combination of what to display and what not is obviously different to each of the customers saved in this debtors database.  I also need rows to display one after the other in a normal letter format when rows of text without the numerical values are ommitted (i.e. no gaps between the text).  How do I do it?


Question by:LillyC
    LVL 31

    Accepted Solution

    Assuming that you have a single textbox control for each line of text, the easiest way to make it disappear if a numeric value is zero is to set the section and  control's CanShrink property to Yes and write code on the Detail_Format event like the following (substituting your control and field names):
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
       If Me![UnitPrice] = 0 Then
          Me![txtProductPrice].Visible = False
          Me![txtProductPrice].Visible = True
       End If
    End Sub

    Open in new window


    Author Closing Comment

    Many thanks, it worked perfectly.  Sorry for a late reply as I was away.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now