Conditional Printing of Comment Line

J

JWeaver

I have a report that I print that sometimes requires a Comment line to be
printed for the employees (i.e., a note regarding a change in pay). How do I
set this line up so that it prints only when there is something entered in
the Comment field in the record? Also, I don't want it to print at all or
leave a blank line if it is empty, just display if it needs to be.
 
A

Allen Browne

In report design view, right-click the Comments text box and choose
Properties. Set the Can Shrink property to Yes.

Now if the field is null, it will not take up any space vertically on the
report. That assumes there is nothing at all beside it that Access has to
show.

If you may want to suppress all comments, you will need a way for the user
to specify when to show comments. For example, you could have a form with an
unbound check box that the user ticks if they want the comments. Assuming
the form is named, Form1, and the checkbox is Chk2, set these properties for
the comments text box on your report:
Control Source =IIf([Forms].[Form1].[Chk2], [Comments], Null)
Name txtComments
Can Shrink Yes
 
J

JWeaver

I added the field to my report and then while still in design view I tried to
preview the report but nothing happened. It stayed on the design view screen
and the report did not display. I had to close the report out completely
without saving and it would then work correctly as long as that field wasn't
included on it. What causes this?
--
JWeaver


Allen Browne said:
In report design view, right-click the Comments text box and choose
Properties. Set the Can Shrink property to Yes.

Now if the field is null, it will not take up any space vertically on the
report. That assumes there is nothing at all beside it that Access has to
show.

If you may want to suppress all comments, you will need a way for the user
to specify when to show comments. For example, you could have a form with an
unbound check box that the user ticks if they want the comments. Assuming
the form is named, Form1, and the checkbox is Chk2, set these properties for
the comments text box on your report:
Control Source =IIf([Forms].[Form1].[Chk2], [Comments], Null)
Name txtComments
Can Shrink Yes

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

JWeaver said:
I have a report that I print that sometimes requires a Comment line to be
printed for the employees (i.e., a note regarding a change in pay). How
do I
set this line up so that it prints only when there is something entered in
the Comment field in the record? Also, I don't want it to print at all or
leave a blank line if it is empty, just display if it needs to be.
 
A

Allen Browne

I haven't seen that behavior in any version of Access.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

JWeaver said:
I added the field to my report and then while still in design view I tried
to
preview the report but nothing happened. It stayed on the design view
screen
and the report did not display. I had to close the report out completely
without saving and it would then work correctly as long as that field
wasn't
included on it. What causes this?
--
JWeaver


Allen Browne said:
In report design view, right-click the Comments text box and choose
Properties. Set the Can Shrink property to Yes.

Now if the field is null, it will not take up any space vertically on the
report. That assumes there is nothing at all beside it that Access has to
show.

If you may want to suppress all comments, you will need a way for the
user
to specify when to show comments. For example, you could have a form with
an
unbound check box that the user ticks if they want the comments. Assuming
the form is named, Form1, and the checkbox is Chk2, set these properties
for
the comments text box on your report:
Control Source =IIf([Forms].[Form1].[Chk2], [Comments], Null)
Name txtComments
Can Shrink Yes

JWeaver said:
I have a report that I print that sometimes requires a Comment line to
be
printed for the employees (i.e., a note regarding a change in pay).
How
do I
set this line up so that it prints only when there is something entered
in
the Comment field in the record? Also, I don't want it to print at all
or
leave a blank line if it is empty, just display if it needs to be.
 

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