Hide null entries on report

G

Guest

I have created a simple form with 10 fields and a report that displays the
information entered on the form. Not all fields will be completed--some will
be left blank from time to time. In this case I want the report to NOT
display the fields that were left blank on the form. I also want to hide the
label for these fields if they are blank.
 
P

Pat Hartman \(MVP\)

In the Format event of the report's Detail section, place code similar to
the following:

If IsNull(Me.fld1) Then
Me.fld1.Visible = False
Me.fld1Lbl.Visible = False
Else
Me.fld1.Visible = True
Me.fld1Lbl.Visible = True
End If
If IsNull(Me.fld2) Then
Me.fld2.Visible = False
Me.fld2Lbl.Visible = False
.....
End If
 
G

Guest

Null values in controls don't display since there is nothing to display. This
assumes there are not any borders since you didn't mention them. To hide the
labels, you can change the labels to text boxes and set their control sources
to something like:
="Last Name " + [LastName]
Make sure the size of the text box is only large enough to display your
"label" value. The text "Last Name" will not display if [LastName] is null.
 

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