Report formatting: how to shrink the controls?

A

Amit

Windows XP, MS Access 2K
========================

Hi,

I'm using a query as a source for a report. Some of the
records have null values for a few fields. The fields are
Phone, Fax, Email and Website.

I have code in the report to display the labels only if
the value is not null. I'm setting the visible property of
the labels true or false depending on the corresponding
value being not null, or null resp.
I also have the Can Grow/Can Shrink properties of the
textboxes, and the Detail section of the report set to Yes.
I have "Phone, Fax and Email" displayed on one line,
and "Website" displayed on second line below it.

The problem I'm having is that when the Phone, Fax and
Email are null, and Website is not null, there is an empty
line above the "Website" line.

Is there any way to shrink the report, so that the empty
line is not displayed, and the text below it is shifted up?

Thanks for any help.

-Amit
 
A

AvalonDave

Hi Amit-

I have the same exact question as you!

Would you mind posting your code where you check whether a certain field is NULL or not? I am having trouble with that too.


Thanks,
Dave
 
A

Amit

-----Original Message-----
Hi Amit-

I have the same exact question as you!

Would you mind posting your code where you check whether
a certain field is NULL or not? I am having trouble with
that too.
Sure. Here it is. The code is in the "Format" property
of "Detail" of the report.

'Make the Phone label visible only if the phone number is
not null
If (IsNull(Me.ResourcePhone)) Then
Me.lblPhone.Visible = False
Else
Me.lblPhone.Visible = True
End If

-Amit
 
M

Marshall Barton

Amit said:
Windows XP, MS Access 2K
========================
I'm using a query as a source for a report. Some of the
records have null values for a few fields. The fields are
Phone, Fax, Email and Website.

I have code in the report to display the labels only if
the value is not null. I'm setting the visible property of
the labels true or false depending on the corresponding
value being not null, or null resp.
I also have the Can Grow/Can Shrink properties of the
textboxes, and the Detail section of the report set to Yes.
I have "Phone, Fax and Email" displayed on one line,
and "Website" displayed on second line below it.

The problem I'm having is that when the Phone, Fax and
Email are null, and Website is not null, there is an empty
line above the "Website" line.

Is there any way to shrink the report, so that the empty
line is not displayed, and the text below it is shifted up?


If you set both the text box and its section's CanShrink
property to Yes, the text box below will move up - UNLESS
there are other controls in the same horizontal band.

An alternative approach is to use a single CanGrow text box
(no label) with an expression that does it all:

=((("Phone: " + [Phone] + " ") & ("Fax: " + [fax] + " ") &
("Email: " + + " ")) + (Chr(13) & Chr(10))) & ("Web
Site: " + [Website])
 

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