Access 2000 Report Footer printing by itself

R

Ray Milhon

I have a report in Access 2000 that has 2 group headers and footers After the
first footer the report starts a new page. So on the final page the Totals
are all by themselves even though there's plenty of room on the previous
page. How can I turn off the new page after if it's the last record. I
can't find any property or variable to use to determine if it's the final
record.

Any help would be appreciated.
 
M

Marshall Barton

Ray said:
I have a report in Access 2000 that has 2 group headers and footers After the
first footer the report starts a new page. So on the final page the Totals
are all by themselves even though there's plenty of room on the previous
page. How can I turn off the new page after if it's the last record. I
can't find any property or variable to use to determine if it's the final
record.

If you are using ForceNewPage, you would have to turn it off
in the last detail sections Format or Print event.

You can tell when you are in the last detail by adding a
hidden text box (named txtLineNum) to the detail section.
Set its control source expression to =1 and its RunningSum
to OverAll.

Then add another hidden text box (named txtTotalLines) to
the report header section and set its control source to
=Count(*)

Then the detail section event can check if its the last
detail by using code like:
If txtLineNum = txtTotalLines Then
'turn off whatever you're using to get the new page
End If
 
R

Ray Milhon

Marshall Barton said:
If you are using ForceNewPage, you would have to turn it off
in the last detail sections Format or Print event.

You can tell when you are in the last detail by adding a
hidden text box (named txtLineNum) to the detail section.
Set its control source expression to =1 and its RunningSum
to OverAll.

Then add another hidden text box (named txtTotalLines) to
the report header section and set its control source to
=Count(*)

Then the detail section event can check if its the last
detail by using code like:
If txtLineNum = txtTotalLines Then
'turn off whatever you're using to get the new page
End If
MVP [MS Access]

Unfortunately that didn't accomplish what I'm trying to do. Maybe my
explanation wasn't right. Let me try again.

The report has a primary group and a secondary group. each with a header
and footer. the report is designed to ForceNewPage after each primary group.
There is a group total in the Group Footer. What I want is that if it's the
last page of the last group I want the Grand totals to print on the same page
as the group totals.

If I enter the code to turn off the ForceNewPage anywhere in the report
(detail, either group footer) it doesn't page between groups at all. The
second group is on the same page as the first group.

I do appreciate the help.
 
R

Ray Milhon

Ok, I figured it out. I added an else clause to the if statement so if it
wasn't the last record it kept forcenewpage = 2. That worked.

Ray Milhon said:
Marshall Barton said:
If you are using ForceNewPage, you would have to turn it off
in the last detail sections Format or Print event.

You can tell when you are in the last detail by adding a
hidden text box (named txtLineNum) to the detail section.
Set its control source expression to =1 and its RunningSum
to OverAll.

Then add another hidden text box (named txtTotalLines) to
the report header section and set its control source to
=Count(*)

Then the detail section event can check if its the last
detail by using code like:
If txtLineNum = txtTotalLines Then
'turn off whatever you're using to get the new page
End If
MVP [MS Access]

Unfortunately that didn't accomplish what I'm trying to do. Maybe my
explanation wasn't right. Let me try again.

The report has a primary group and a secondary group. each with a header
and footer. the report is designed to ForceNewPage after each primary group.
There is a group total in the Group Footer. What I want is that if it's the
last page of the last group I want the Grand totals to print on the same page
as the group totals.

If I enter the code to turn off the ForceNewPage anywhere in the report
(detail, either group footer) it doesn't page between groups at all. The
second group is on the same page as the first group.

I do appreciate the help.
 
M

Marshall Barton

Ray said:
Ok, I figured it out. I added an else clause to the if statement so if it
wasn't the last record it kept forcenewpage = 2. That worked.


Right. I should have included that part in my posted code.
 
R

Ray Milhon

Thanks for your help. I would have been struggling with that all weekend if
you hadn't pointed me in the right direction.
 

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