subreport groupheaders with no detail

G

GARY ACORD

Here's the situation, I have a report with multiple subreports. Each
subreport is inside it's own groupheader (putting them all in the detail
section causes sporadic results)

Most subreports are using the "=1" trick to fake a repeating section header.

Two of the subreports have detail sections that can get quite long (due to
growable memo fields in the data). These two are the reason for the email.

In most cases they do like they are supposed to do, print their pseudo
header and the beginnings, at least, of the first detail. However,
sometimes they print just the header at the bottom of the page (this can be
just the header bar itself or even enough white space to have fit 2 or 3
fields of data). If I set the KeepTogether to True for that group (on the
main report) then that particular report will print fine. but then the next
might try to KeepTogether and leave me with 4 inches of white space. So,
then I have to switch KeepTogether to False. And so it goes. about every
3-5 reports it has to be switched.

I've looked into using the PrintSection and MoveLayout properties and
checking the Top value for the subreport. Unfortunately, when I check the
Top of the subreport (doesn't seem to matter where I check it) I get it's
top relative to the group it's in, instead of relative to the page.

Any ideas?
 
M

Marshall Barton

GARY said:
Here's the situation, I have a report with multiple subreports. Each
subreport is inside it's own groupheader (putting them all in the detail
section causes sporadic results)

Most subreports are using the "=1" trick to fake a repeating section header.

Two of the subreports have detail sections that can get quite long (due to
growable memo fields in the data). These two are the reason for the email.

In most cases they do like they are supposed to do, print their pseudo
header and the beginnings, at least, of the first detail. However,
sometimes they print just the header at the bottom of the page (this can be
just the header bar itself or even enough white space to have fit 2 or 3
fields of data). If I set the KeepTogether to True for that group (on the
main report) then that particular report will print fine. but then the next
might try to KeepTogether and leave me with 4 inches of white space. So,
then I have to switch KeepTogether to False. And so it goes. about every
3-5 reports it has to be switched.


It sounds like you're setting the psuedo group header
section's KeepTogether.

Try setting the psuedo group's KeepTogether property (in the
Sorting and Grouping window) to With First Detail.
 
G

GARY ACORD

tried that. what happens then, is that if the whole detail section (which
can span multiple pages, or use up no space at all, depending on the data)
is too long to fit on the remainder of the page then it skips to the next
page. that would be fine if it only left an inch or so of whitespace. but
sometimes it could leave 5 inches of whitespace. which is unacceptable to
my client.

i've honestly tried every flavor of KeepTogether (both in the Sorting and
Grouping as well as in the property sheets) and the thing is that different
settings work depending on the content of the record it happens to be
printing.

the closest thing to a solution that i've come across is an MS KB article
that passes the subreport object and a bottom value (meaning how far down
the page is too far) but the code looks for the Top of the subreport then
modifies MoveLayout and PrintSection accordingly. but, since the subreport
is in a GroupHeader, it's Top never changes, no matter where on the page it
really is.

If there is a good way to get the true Top of the subreport relative to teh
page, I can probably brute force it into submission. I'd like to not have
to go back to the client and just tell them we'll need to force a New page
before this report section.

any other ideas?
 
M

Marshall Barton

GARY said:
tried that. what happens then, is that if the whole detail section (which
can span multiple pages, or use up no space at all, depending on the data)
is too long to fit on the remainder of the page then it skips to the next
page. that would be fine if it only left an inch or so of whitespace. but
sometimes it could leave 5 inches of whitespace. which is unacceptable to
my client.

OK, I thought it was all the details were jumping to the
next page. I didn't realize you were talking about a single
detail.

i've honestly tried every flavor of KeepTogether (both in the Sorting and
Grouping as well as in the property sheets) and the thing is that different
settings work depending on the content of the record it happens to be
printing.

the closest thing to a solution that i've come across is an MS KB article
that passes the subreport object and a bottom value (meaning how far down
the page is too far) but the code looks for the Top of the subreport then
modifies MoveLayout and PrintSection accordingly. but, since the subreport
is in a GroupHeader, it's Top never changes, no matter where on the page it
really is.

If there is a good way to get the true Top of the subreport relative to teh
page, I can probably brute force it into submission. I'd like to not have
to go back to the client and just tell them we'll need to force a New page
before this report section.

Instead of checking the section's Top property, check the
report's Top property, which tells you where on the page the
top of the current section is positioned. How's that for a
confusing explanation ;-)

As an example, if you have a PageBreak control named
pgNewPage at the top of the group header then you could
"activate" or "deactivate" it by making it visible or
invisible. So, if you want the header to move to the next
page if it would be more than 9 inches down the page:

Me.pgNewPage.Visible = (Me.Top > 9*1440)
--
Marsh
MVP [MS Access]


 
G

GARY ACORD

Except...
I was trying to check the reports.top property.

the subreport is within a groupheader of the main report (they all are, it's
only way i can have some modest control over them) and when i try to get the
subreport's top (from within the subreport or from within the mainreport's
group section that is holding it) it's not giving me the top relative to the
page. it's giving me the top relative to the group. so, for example, if in
design view i set the subreport to be at .25 top within it's main report
group. then at runtime if i ask for the top value i get .25 no matter where
it falls on the actuall page.

i'm assuming this is because it's inside of a group. but i'm totally
stumped.
Marshall Barton said:
GARY said:
tried that. what happens then, is that if the whole detail section (which
can span multiple pages, or use up no space at all, depending on the data)
is too long to fit on the remainder of the page then it skips to the next
page. that would be fine if it only left an inch or so of whitespace. but
sometimes it could leave 5 inches of whitespace. which is unacceptable to
my client.

OK, I thought it was all the details were jumping to the
next page. I didn't realize you were talking about a single
detail.

i've honestly tried every flavor of KeepTogether (both in the Sorting and
Grouping as well as in the property sheets) and the thing is that different
settings work depending on the content of the record it happens to be
printing.

the closest thing to a solution that i've come across is an MS KB article
that passes the subreport object and a bottom value (meaning how far down
the page is too far) but the code looks for the Top of the subreport then
modifies MoveLayout and PrintSection accordingly. but, since the subreport
is in a GroupHeader, it's Top never changes, no matter where on the page it
really is.

If there is a good way to get the true Top of the subreport relative to teh
page, I can probably brute force it into submission. I'd like to not have
to go back to the client and just tell them we'll need to force a New page
before this report section.

Instead of checking the section's Top property, check the
report's Top property, which tells you where on the page the
top of the current section is positioned. How's that for a
confusing explanation ;-)

As an example, if you have a PageBreak control named
pgNewPage at the top of the group header then you could
"activate" or "deactivate" it by making it visible or
invisible. So, if you want the header to move to the next
page if it would be more than 9 inches down the page:

Me.pgNewPage.Visible = (Me.Top > 9*1440)
--
Marsh
MVP [MS Access]


(due
to can
be the
next
 
M

Marshall Barton

GARY said:
Except...
I was trying to check the reports.top property.

the subreport is within a groupheader of the main report (they all are, it's
only way i can have some modest control over them) and when i try to get the
subreport's top (from within the subreport or from within the mainreport's
group section that is holding it) it's not giving me the top relative to the
page. it's giving me the top relative to the group. so, for example, if in
design view i set the subreport to be at .25 top within it's main report
group. then at runtime if i ask for the top value i get .25 no matter where
it falls on the actuall page.

i'm assuming this is because it's inside of a group. but i'm totally
stumped.

Maybe I still don't understand, I thought you wanted to get
the subreport positioned so it wasn't too close to the
bottom of the page. If so, then my suggested code would be
in the main report's header section's format event, not in
each subreport. If you're trying to put all the subreports
into a single header section, that will probably not be
workable. Instead create a separate header for each
subreport (using the =1 grouping).

If that doesn't help (and the way I'm going today, it
won't), please explain in more detail about the headers in
the main report and where each subreport fits into them.
--
Marsh
MVP [MS Access]



 
G

GARY ACORD

in the Main report's header group (individual groups for each sub is
correct) i've tried looking at the subreport's top value. no matter where
on the page it falls at print tiem or format time, it always gives me teh
value for where the top of the subreport is within the group header.

for example, if i put the (in design view) top=0 then i will always get 0
when i check the top value at runtime. if i put it at top=0.25 then i will
get the the twips equivilant of 0.25.

i can't seem to get a REAL value for where the sub is landing on teh page.
Marshall Barton said:
GARY said:
Except...
I was trying to check the reports.top property.

the subreport is within a groupheader of the main report (they all are, it's
only way i can have some modest control over them) and when i try to get the
subreport's top (from within the subreport or from within the mainreport's
group section that is holding it) it's not giving me the top relative to the
page. it's giving me the top relative to the group. so, for example, if in
design view i set the subreport to be at .25 top within it's main report
group. then at runtime if i ask for the top value i get .25 no matter where
it falls on the actuall page.

i'm assuming this is because it's inside of a group. but i'm totally
stumped.

Maybe I still don't understand, I thought you wanted to get
the subreport positioned so it wasn't too close to the
bottom of the page. If so, then my suggested code would be
in the main report's header section's format event, not in
each subreport. If you're trying to put all the subreports
into a single header section, that will probably not be
workable. Instead create a separate header for each
subreport (using the =1 grouping).

If that doesn't help (and the way I'm going today, it
won't), please explain in more detail about the headers in
the main report and where each subreport fits into them.
--
Marsh
MVP [MS Access]



unacceptable
to page
it to
teh (this
can or
3 space.
So,
 
M

Marshall Barton

GARY said:
in the Main report's header group (individual groups for each sub is
correct) i've tried looking at the subreport's top value. no matter where
on the page it falls at print tiem or format time, it always gives me teh
value for where the top of the subreport is within the group header.

i can't seem to get a REAL value for where the sub is landing on teh page.


That's right, the subreport control's Top is relative to the
section, BUT what I'm having so much trouble communicating
is that (in the main report's group header's Format event),
the subreport control's position on the page is provided by:

Me.Top + Me.subreportcontrol.Top
--
Marsh
MVP [MS Access]



GARY said:
Except...
I was trying to check the reports.top property.

the subreport is within a groupheader of the main report (they all are, it's
only way i can have some modest control over them) and when i try to get the
subreport's top (from within the subreport or from within the mainreport's
group section that is holding it) it's not giving me the top relative to the
page. it's giving me the top relative to the group. so, for example, if in
design view i set the subreport to be at .25 top within it's main report
group. then at runtime if i ask for the top value i get .25 no matter where
it falls on the actuall page.

i'm assuming this is because it's inside of a group. but i'm totally
stumped.
"Marshall Barton" wrote
Maybe I still don't understand, I thought you wanted to get
the subreport positioned so it wasn't too close to the
bottom of the page. If so, then my suggested code would be
in the main report's header section's format event, not in
each subreport. If you're trying to put all the subreports
into a single header section, that will probably not be
workable. Instead create a separate header for each
subreport (using the =1 grouping).

If that doesn't help (and the way I'm going today, it
won't), please explain in more detail about the headers in
the main report and where each subreport fits into them.
--
Marsh
MVP [MS Access]



GARY ACORD wrote:

tried that. what happens then, is that if the whole detail section
(which
can span multiple pages, or use up no space at all, depending on the
data)
is too long to fit on the remainder of the page then it skips to the next
page. that would be fine if it only left an inch or so of whitespace.
but
sometimes it could leave 5 inches of whitespace. which is unacceptable
to
my client.

OK, I thought it was all the details were jumping to the
next page. I didn't realize you were talking about a single
detail.


i've honestly tried every flavor of KeepTogether (both in the Sorting and
Grouping as well as in the property sheets) and the thing is that
different
settings work depending on the content of the record it happens to be
printing.

the closest thing to a solution that i've come across is an MS KB article
that passes the subreport object and a bottom value (meaning how far down
the page is too far) but the code looks for the Top of the subreport then
modifies MoveLayout and PrintSection accordingly. but, since the
subreport
is in a GroupHeader, it's Top never changes, no matter where on the page
it
really is.

If there is a good way to get the true Top of the subreport relative to
teh
page, I can probably brute force it into submission. I'd like to not
have
to go back to the client and just tell them we'll need to force a New
page
before this report section.

Instead of checking the section's Top property, check the
report's Top property, which tells you where on the page the
top of the current section is positioned. How's that for a
confusing explanation ;-)

As an example, if you have a PageBreak control named
pgNewPage at the top of the group header then you could
"activate" or "deactivate" it by making it visible or
invisible. So, if you want the header to move to the next
page if it would be more than 9 inches down the page:

Me.pgNewPage.Visible = (Me.Top > 9*1440)


GARY ACORD wrote:
Here's the situation, I have a report with multiple subreports. Each
subreport is inside it's own groupheader (putting them all in the
detail
section causes sporadic results)

Most subreports are using the "=1" trick to fake a repeating section
header.

Two of the subreports have detail sections that can get quite long
(due
to
growable memo fields in the data). These two are the reason for the
email.

In most cases they do like they are supposed to do, print their pseudo
header and the beginnings, at least, of the first detail. However,
sometimes they print just the header at the bottom of the page (this
can
be
just the header bar itself or even enough white space to have fit 2 or
3
fields of data). If I set the KeepTogether to True for that group (on
the
main report) then that particular report will print fine. but then
the
next
might try to KeepTogether and leave me with 4 inches of white space.
So,
then I have to switch KeepTogether to False. And so it goes. about
every
3-5 reports it has to be switched.


It sounds like you're setting the psuedo group header
section's KeepTogether.

Try setting the psuedo group's KeepTogether property (in the
Sorting and Grouping window) to With First Detail.
 
G

GARY ACORD

i'm finally with you! and, by the way, that does give me the correct top
placement. but only on the first run (which is all i care about) each
subsequent check of that value ends up giving me negative numbers (in cases
where the subreport begins to span multiple pages, which it can if there is
a lot of detail in the memo field that is the meat and potatoes of this
problem-child of a subreport)

now, i just have to work out the correct combination to get it to skip on to
the next page when it's too far down on the first run.

i'll forward to the list here when i have it.

cheers,
g

Marshall Barton said:
GARY said:
in the Main report's header group (individual groups for each sub is
correct) i've tried looking at the subreport's top value. no matter where
on the page it falls at print tiem or format time, it always gives me teh
value for where the top of the subreport is within the group header.

i can't seem to get a REAL value for where the sub is landing on teh
page.


That's right, the subreport control's Top is relative to the
section, BUT what I'm having so much trouble communicating
is that (in the main report's group header's Format event),
the subreport control's position on the page is provided by:

Me.Top + Me.subreportcontrol.Top
--
Marsh
MVP [MS Access]



GARY said:
Except...
I was trying to check the reports.top property.

the subreport is within a groupheader of the main report (they all
are,
it's
only way i can have some modest control over them) and when i try to
get
the
subreport's top (from within the subreport or from within the mainreport's
group section that is holding it) it's not giving me the top relative
to
the
page. it's giving me the top relative to the group. so, for example,
if
in
design view i set the subreport to be at .25 top within it's main report
group. then at runtime if i ask for the top value i get .25 no matter where
it falls on the actuall page.

i'm assuming this is because it's inside of a group. but i'm totally
stumped.
"Marshall Barton" wrote
Maybe I still don't understand, I thought you wanted to get
the subreport positioned so it wasn't too close to the
bottom of the page. If so, then my suggested code would be
in the main report's header section's format event, not in
each subreport. If you're trying to put all the subreports
into a single header section, that will probably not be
workable. Instead create a separate header for each
subreport (using the =1 grouping).

If that doesn't help (and the way I'm going today, it
won't), please explain in more detail about the headers in
the main report and where each subreport fits into them.
--
Marsh
MVP [MS Access]




GARY ACORD wrote:

tried that. what happens then, is that if the whole detail section
(which
can span multiple pages, or use up no space at all, depending on the
data)
is too long to fit on the remainder of the page then it skips to
the
next
page. that would be fine if it only left an inch or so of whitespace.
but
sometimes it could leave 5 inches of whitespace. which is unacceptable
to
my client.

OK, I thought it was all the details were jumping to the
next page. I didn't realize you were talking about a single
detail.


i've honestly tried every flavor of KeepTogether (both in the
Sorting
and
Grouping as well as in the property sheets) and the thing is that
different
settings work depending on the content of the record it happens to be
printing.

the closest thing to a solution that i've come across is an MS KB article
that passes the subreport object and a bottom value (meaning how
far
down
the page is too far) but the code looks for the Top of the
subreport
then
modifies MoveLayout and PrintSection accordingly. but, since the
subreport
is in a GroupHeader, it's Top never changes, no matter where on the page
it
really is.

If there is a good way to get the true Top of the subreport
relative
to
teh
page, I can probably brute force it into submission. I'd like to not
have
to go back to the client and just tell them we'll need to force a New
page
before this report section.

Instead of checking the section's Top property, check the
report's Top property, which tells you where on the page the
top of the current section is positioned. How's that for a
confusing explanation ;-)

As an example, if you have a PageBreak control named
pgNewPage at the top of the group header then you could
"activate" or "deactivate" it by making it visible or
invisible. So, if you want the header to move to the next
page if it would be more than 9 inches down the page:

Me.pgNewPage.Visible = (Me.Top > 9*1440)


GARY ACORD wrote:
Here's the situation, I have a report with multiple subreports. Each
subreport is inside it's own groupheader (putting them all in the
detail
section causes sporadic results)

Most subreports are using the "=1" trick to fake a repeating section
header.

Two of the subreports have detail sections that can get quite long
(due
to
growable memo fields in the data). These two are the reason for the
email.

In most cases they do like they are supposed to do, print their pseudo
header and the beginnings, at least, of the first detail. However,
sometimes they print just the header at the bottom of the page (this
can
be
just the header bar itself or even enough white space to have
fit 2
or
3
fields of data). If I set the KeepTogether to True for that
group
(on
the
main report) then that particular report will print fine. but then
the
next
might try to KeepTogether and leave me with 4 inches of white space.
So,
then I have to switch KeepTogether to False. And so it goes. about
every
3-5 reports it has to be switched.


It sounds like you're setting the psuedo group header
section's KeepTogether.

Try setting the psuedo group's KeepTogether property (in the
Sorting and Grouping window) to With First Detail.
 
M

Marshall Barton

GARY said:
i'm finally with you! and, by the way, that does give me the correct top
placement. but only on the first run (which is all i care about) each
subsequent check of that value ends up giving me negative numbers (in cases
where the subreport begins to span multiple pages, which it can if there is
a lot of detail in the memo field that is the meat and potatoes of this
problem-child of a subreport)

Whew! ;-)

Those negative numbers are still supposed to be the position
on the page. They're negative because the section's top is
above the top of the currrent page (i.e. on a previous
page).

OTOH, you can use the fact that they're ngative to indicate
that you're in the header's Format event for the second or
later time and just exit the procedure.

now, i just have to work out the correct combination to get it to skip on to
the next page when it's too far down on the first run.

As I hinted at before, if you want the subreport to move to
the top of the next page when it would be more than 9 inches
down the page, plaxe a Page Break control just above the
subreport control. Then add this code to the Format event:

Me.pgNewPage.Visible = (Me.Top + Me.subreport.Top > 9*1440)

With this simple logic, you don't even have to worry about
Me.Top being negative.
 

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