Page breaks and other formatting

  • Thread starter Thread starter BruceM
  • Start date Start date
B

BruceM

I have a database for tracking recommendations. Each recommendation goes
through a four-step procedure (Recommendation, Response, Follow-up, Final
Approval). If each of the sections is fairly short, the report will fit on
one page, but in many cases the report will take two pages. In that case I
would like to have the page break occur between Response and Follow-up or
Follow-up and Final (it will probably never occur between Recommendation and
Response). Another option would be to have the page break, if one is
needed, always fall between Response and Follow-up. How can this be
arranged?
Also, I need to allow for the possibility that at some point (at Response or
at Recommendation) the report will be printed and filled out by hand. As it
stands now the text box in each of those sections is one line high, and can
grow. However, if the report is filled out by hand it will need to start
with enough room to complete the Response or Recommendation. I had thought
that one way to do this may be to set the text box in each of those sections
to something like 1.5", and its Can Shrink property to No. Then,
programatically, I could change the Can Shrink property to Yes. However, I
can't figure out how to set Can Shrink programatically. Also, if I could
set it, I would need to set it back when going to the next record. Or maybe
I'm completely off the mark here. I just need to find the best way to
accomplish these two things.
 
The simplest thing is to put the boxes into different sections in report
design. By setting each section's Keep Together property to Yes, the break
will occur between sections if a page break is needed.

In report design view, open the Sorting And Grouping box (View menu.)
Select the primary key field, and in the lower pane of the dialog, set:
Group Header Yes
Group Footer Yes
Access adds 2 new sections to the report.
Move the Recommendation text box up into the group header.
Move the Follow-up and Approval text boxes down into the group footer.
The report will now naturally break between sections.

Outputting data from a report that has none is a bit of a challenge. Any
calculated controls tend to generate #Error, so you need to test the HasData
property of the report and output a null if that is true. In your case, you
can force the text box to a certain height by outputting Carriage Return +
Line Feed pairs, such as:
=IIf([Report].[HasData], [Recommendation], Chr(13) & Chr(10) & Chr(13) &
Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10))

Be sure to change the Name of the text box as well: Access gets confused if
it has the same Name as a field, but is bound to something else.
 
Thanks for the reply. I will try using the sections in the group header and
footer as you suggest.
Regarding the other part of your reply, the question is not necessarily
whether the report has data, but whether the text box contains data. If the
Response is complete and the person doing the Follow-up decides they would
rather print the report and write the follow-up by hand, the text box that
would contain the Follow-up needs to have room for some writing.
Nevertheless, I see where you're going with this, and will do some
experimenting. It had not occurred to me to use carriage return and line
feed in this way, but it seems to be quite simple and direct. I like those
kinds of solutions. Thanks again.

Allen Browne said:
The simplest thing is to put the boxes into different sections in report
design. By setting each section's Keep Together property to Yes, the break
will occur between sections if a page break is needed.

In report design view, open the Sorting And Grouping box (View menu.)
Select the primary key field, and in the lower pane of the dialog, set:
Group Header Yes
Group Footer Yes
Access adds 2 new sections to the report.
Move the Recommendation text box up into the group header.
Move the Follow-up and Approval text boxes down into the group footer.
The report will now naturally break between sections.

Outputting data from a report that has none is a bit of a challenge. Any
calculated controls tend to generate #Error, so you need to test the
HasData property of the report and output a null if that is true. In your
case, you can force the text box to a certain height by outputting
Carriage Return + Line Feed pairs, such as:
=IIf([Report].[HasData], [Recommendation], Chr(13) & Chr(10) & Chr(13)
& Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Chr(13) & Chr(10))

Be sure to change the Name of the text box as well: Access gets confused
if it has the same Name as a field, but is bound to something else.

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

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

BruceM said:
I have a database for tracking recommendations. Each recommendation goes
through a four-step procedure (Recommendation, Response, Follow-up, Final
Approval). If each of the sections is fairly short, the report will fit
on one page, but in many cases the report will take two pages. In that
case I would like to have the page break occur between Response and
Follow-up or Follow-up and Final (it will probably never occur between
Recommendation and Response). Another option would be to have the page
break, if one is needed, always fall between Response and Follow-up. How
can this be arranged?
Also, I need to allow for the possibility that at some point (at Response
or at Recommendation) the report will be printed and filled out by hand.
As it stands now the text box in each of those sections is one line high,
and can grow. However, if the report is filled out by hand it will need
to start with enough room to complete the Response or Recommendation. I
had thought that one way to do this may be to set the text box in each of
those sections to something like 1.5", and its Can Shrink property to No.
Then, programatically, I could change the Can Shrink property to Yes.
However, I can't figure out how to set Can Shrink programatically. Also,
if I could set it, I would need to set it back when going to the next
record. Or maybe I'm completely off the mark here. I just need to find
the best way to accomplish these two things.
 
Back
Top