Dynamic or conditional page break?

N

Niniel

Hello,

I was wondering if there was such a thing as a "dynamic [or conditional]
page break". With that I mean the following:

I have 2 memo fields in my table, and of course I cannot predict how much
text will be in those.
So what's the best way to put those on the report without wasting too much
space?
I could have them adjust in size automatically depending on amount of the
text inside, but to do about the things that come afterwards?
I was thinking that maybe there was a way to put a page break in the report
that only starts a new page if the memo field takes up more than 50 % of the
page.

Or would it be better just to give each memo field a page, or maybe 1/2 page
and be done with it?

Any thoughts?
Thanks.
 
M

Marshall Barton

Niniel said:
I was wondering if there was such a thing as a "dynamic [or conditional]
page break". With that I mean the following:

I have 2 memo fields in my table, and of course I cannot predict how much
text will be in those.
So what's the best way to put those on the report without wasting too much
space?
I could have them adjust in size automatically depending on amount of the
text inside, but to do about the things that come afterwards?
I was thinking that maybe there was a way to put a page break in the report
that only starts a new page if the memo field takes up more than 50 % of the
page.


There are a lot of features that you can use in this kind of
situation. The most obvious is the CanGrow property for
both the text boxes that are bound to the memo fields and
the report section that contains the text boxes.

Depending on your objectives, the section's (or group's)
KeepTogether property may be useful. While KeepTogether
does not apply to individual text boxes, you can add one or
more low level Groups (based on the primary key field) and
spread the text boxes across multiple sections and specify
KeepTogether for the collections of text boxes in each
section.

Another possibility is to use Page Break controls between
the text boxes. You can activate/deactivate the page break
controls by using code the make them visible or invisible.
In your case, this is probably the most difficult technique
because determining the final size of a can grow text box is
a very complex procedure.

I doubt if it would be useful in your case, but each section
also has a ForceNewPage property.
 
N

Niniel

Ah, that was very interesting, thank you.
I don't really have any sections at this point; everything is in the Detail
group.
Although that's probably not such a good idea as I am already running out of
design space.
 
L

Larry Linson

Niniel said:
Ah, that was very interesting, thank you.
I don't really have any sections at this point; everything
is in the Detail group.

That is, strictly speaking, the Detail Section of the Report.
Although that's probably not such a good idea
as I am already running out of design space.

I am not certain what you mean, as the amount of data that can be included
in a 22" x 22" Detail Section is at least "significant", and using the
CanGrow/CanShrink properties on the Text Boxes displaying the Memo fields
will allow it to print even larger...

And, of course, the Detail Section prints once for each Record in the
RecordSource of the Report.

It is the appropriate _presentation_ of data that would determine whether
you include other Sections in your Report, or whether you group the data.

Larry Linson
Microsoft Access MVP
 
N

Niniel

Well, group, section - same thing, isn't it? :)

As for me running out of space, I'm at about 50 % right now. I guess I'm not
designing my report very efficiently then, but I have a 8 tab form that I
need to turn into a report for printing, generating as few pages of paper as
possible.
I could save some space on the main report design page by using a number of
subreports, but I have coloured frames as backgrounds, and those have to be
as large as the area the subreport will eventually cover, so there goes all
that precious real estate [if there's a better method I don't know about it].

I'm also having trouble with positioning unbound textboxes right next to my
subreport... they are either below the report, or in the middle of it, when I
need them at the bottom. But that's a different story. :)
 
L

Larry Linson

Niniel said:
Well, group, section - same thing, isn't it? :)

Generically speaking, perhaps so. In Access terms, a Section and Group are
quite different. It's difficult to respond with good answers if we don't
understand what the poster's meaning is.
As for me running out of space, I'm at about 50 %
right now. I guess I'm not designing my report very
efficiently then, but I have a 8 tab form that I need
to turn into a report for printing, generating as few
pages of paper as possible.

If it were my report, I'd be concerned that I might be "overwhelming" the
users with too much information and look at ways to simplify -- perhaps
separate reports, or subreports. You may well decide that no, you are not
overwhelming them, given your colored backgrounds, etc.
I could save some space on the main report design
page by using a number of subreports, but I have
coloured frames as backgrounds, and those have
to be as large as the area the subreport will eventually
cover, so there goes all that precious real estate [if
there's a better method I don't know about it].

If your Subreport Controls can be positioned such that there are no other
main Report Controls alongside them, and you use the CanGrow/CanShrink
property, this may be the answer to your colored Frame to contain the
Reports in the Subreport Control, use a colored background in the Reports
embedded in the Subreport Control. Another possibility is to specify a
Border on the Subreport Control that is not Transparent, a Border Width that
will show up, and different Border Colors (though that may not give you
enough definition, if used alone).
I'm also having trouble with positioning unbound textboxes right next to my
subreport... they are either below the report, or in the middle of it, when I
need them at the bottom. But that's a different story. :)

I'd suggest you start a new thread and give details on this, because I don't
understand... there should be no problem positioning a Text Box alongside a
Subreport Control. If the problem is that it prevents the Subreport from
growing or doesn't move along with the Subrepor as it grows, that would be
"by design."

For the record, even though we use verbal shortcuts sometimes, there is
nothing in Access just called a "Subreport" -- there is a "Subreport
Control" into which a Report or Datasheet can be embedded. Sometimes that
terminology gets in the way of accurate answers, too.

Good luck with your project.

Larry Linson
Microsoft Access MVP
 
N

Niniel

Thanks a lot.
Also thanks for clarifying the terminology. I know I'm quite ignorant in
that regard.

Btw, my project is a questionnaire, and the report is just to print a
hardcopy of a record that is being looked at/edited, so I don't think it'll
be overwhelming.
If your Subreport Controls can be positioned such that there are no other
main Report Controls alongside them, and you use the CanGrow/CanShrink
property, this may be the answer to your colored Frame to contain the
Reports in the Subreport Control, use a colored background in the Reports
embedded in the Subreport Control.

I had thought about that, but in this particular case, I have 2 subreport
controls next to each other, and they are of different length in print view.
But maybe I can use this method elsewhere.
Subreports seem to auto-grow by default, so that'll be very helpful in
saving design space.
I'd suggest you start a new thread and give details on this, because I don't
understand... there should be no problem positioning a Text Box alongside a
Subreport Control. If the problem is that it prevents the Subreport from
growing or doesn't move along with the Subrepor as it grows, that would be
"by design."

Ok, will do.
 
M

Marshall Barton

Niniel said:
[...] this may be the answer to your colored Frame to contain the
Reports in the Subreport Control, use a colored background in the Reports
embedded in the Subreport Control. []
I had thought about that, but in this particular case, I have 2 subreport
controls next to each other, and they are of different length in print view.
But maybe I can use this method elsewhere.
Subreports seem to auto-grow by default, so that'll be very helpful in
saving design space.
[]

If you need the two subreport's background to be the same
height as the taller subreport, you can use code in the
detail section's Format event to draw the rectangles:

If sub1.Height > sub2.Height Then
Me.Line (sub1.Left, sub1.Top) - _
Step(sub1.Width, sub1.Height), vbRed, BF
Me.Line (sub2.Left, sub1.Top) - _
Step(sub2.Width, sub1.Height), vbGreen, BF
Else
Me.Line (sub1.Left, sub2.Top) - _
Step(sub1.Width, sub2.Height), vbRed, BF
Me.Line (sub2.Left, sub2.Top) - _
Step(sub2.Width, sub2.Height), vbGreen, BF
End If

Make sure that you set both the subreport's Top property to
the same value in design view.
 
N

Niniel

Oh, this is cool, thank you VERY much!

The one thing I had to change was put it in the On Print event; in the On
Format event, the rectangle was only the size of the control in design view.
 
N

Niniel

Btw. how can I get light grey? Looks like the vb constants only offer a few
colours, and no shade of grey at all.
 
N

Niniel

I figured it out - instead of using vbYellow - which does print as a very
light grey on a b/w laser printer - I used RGB(192,192,192).
Great stuff. Thanks again.
 
M

Marshall Barton

I'm glad you caught that. I really was thinking Print
event, even if my fingers typed Format event :-\
 
M

Marshall Barton

Niniel said:
Btw. how can I get light grey? Looks like the vb constants only offer a few
colours, and no shade of grey at all.


For any thing other than the basic colors, use the RGB
function. RGB allows you to specify the Red, Green and Blue
components of any of the possible 16 million colors. E.g.

RGB(255,0,0) is the same as vbRed
RGB(192,192,192) is a light gray
RGB(128,255,128) is a light green
 
A

Allie

Marshall,
Do you know how to add a page break to a report in Access 07?
Struggling!

Thanks,
Allie




Marshall Barton said:
Niniel said:
I was wondering if there was such a thing as a "dynamic [or conditional]
page break". With that I mean the following:

I have 2 memo fields in my table, and of course I cannot predict how much
text will be in those.
So what's the best way to put those on the report without wasting too much
space?
I could have them adjust in size automatically depending on amount of the
text inside, but to do about the things that come afterwards?
I was thinking that maybe there was a way to put a page break in the report
that only starts a new page if the memo field takes up more than 50 % of the
page.


There are a lot of features that you can use in this kind of
situation. The most obvious is the CanGrow property for
both the text boxes that are bound to the memo fields and
the report section that contains the text boxes.

Depending on your objectives, the section's (or group's)
KeepTogether property may be useful. While KeepTogether
does not apply to individual text boxes, you can add one or
more low level Groups (based on the primary key field) and
spread the text boxes across multiple sections and specify
KeepTogether for the collections of text boxes in each
section.

Another possibility is to use Page Break controls between
the text boxes. You can activate/deactivate the page break
controls by using code the make them visible or invisible.
In your case, this is probably the most difficult technique
because determining the final size of a can grow text box is
a very complex procedure.

I doubt if it would be useful in your case, but each section
also has a ForceNewPage property.
 
A

Allie

Niniel,
Can there be more than one detail group?
I am running out of space as well and would like to breka my detail into 3
pages. Any ideas? What did you end up doing?

Allie
 

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