making an empty (null) field disappear from a report

P

Paul Ponzelli

I have a memo field called "Notes" which I would like to include in the
bottom line of the Detail secion in a report. However, this field is null
more often than not, and I don't want it to occupy any vertical space when
it's empty.

I realize I can set the "CanShrink" property to "No" to make the control
disappear when null, but I would also like to reduce the Height property of
the Detail section so there won't be a blank space.

I've set the "CanShrink" property of the "Notes" field to "No" and tried the
following code in the Report's Detail_Format event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me!Notes) Then
Me.Detail.Height = X
Else
Me.Detail.Height = Y
End If
End Sub

but regardless of the values I use for X, (even 0), there still remains a
blank line in the detail section for that null "Notes" field.

Is there any way I can get the Detail section to shrink down and eliminate
that line when the Notes field is Null?

Thanks in advance,

Paul
 
M

Marshall Barton

Paul said:
I have a memo field called "Notes" which I would like to include in the
bottom line of the Detail secion in a report. However, this field is null
more often than not, and I don't want it to occupy any vertical space when
it's empty.

I realize I can set the "CanShrink" property to "No" to make the control
disappear when null, but I would also like to reduce the Height property of
the Detail section so there won't be a blank space.

I've set the "CanShrink" property of the "Notes" field to "No" and tried the
following code in the Report's Detail_Format event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me!Notes) Then
Me.Detail.Height = X
Else
Me.Detail.Height = Y
End If
End Sub

but regardless of the values I use for X, (even 0), there still remains a
blank line in the detail section for that null "Notes" field.

Is there any way I can get the Detail section to shrink down and eliminate
that line when the Notes field is Null?


Set both the Notes text box AND the detail section CanShrink
to Yes.
 
P

Paul Ponzelli

Another approach that works. Thanks, Karl.

At first I wondered how you could shrink the detail section down to a
hairline when there are controls present, but then I realized you can also
drag the vertical height of the controls themselves down to a hairline
height, provided you set their "CanGrow" property to "Yes." as you
suggested.
 

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

Similar Threads

report detail section 2
If Empty/null field, hide label (?) 2
Eliminate blank lines 2
Charts on a Report 4
How to suppress blank yes/no fields 0
Detail 10
Images on Report 7
Supressing Text in a Report 2

Top