Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Page Header appears at top of sub-report

Posted on 2004-10-02
11
Medium Priority
?
427 Views
Last Modified: 2006-11-17
I have a report that has a sub-report in the Report Footer.

My main report has a Page Header, but the trouble is that the Page Header appears at the top of my sub-report too.

I want the Page Header to appear at the top of my main report only. If my sub-report runs into many pages then I don't want the main report Page Header to appear at the top.

How do I do this? Thanks.
0
Comment
Question by:Annu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
11 Comments
 
LVL 2

Expert Comment

by:grayderek
ID: 12208904
Odd that you want to view data in a page footer but there is obviouly a reason.  Report header and footer appears on the first page and last page of the report, Page Header band footer infor appears on each page.  Detail appears on multiple pages depending on the amount of data.

Move the Page header info into the report header area this will only print on the first page.
0
 
LVL 8

Expert Comment

by:pjcrooks2000
ID: 12208910
Ok i think I get what you mean and that is you want your page header to show up on the first page only of your report but I am not sure what relevance this actually has to the Sub Report.

However lets assume you have a report with a page header and all you have in the page header is the Title of the report then you obvioucly do not want the title to appear page after page but only on the first page then do this below.

Open the report in design view and create a text control in the page header, select the properties for the text control and under the Format tab set Visible to no, also under the Data tab type this into control source:

="Page " & [Page] & " of" & [Pages]

Then whilst you have the propertied window open click on the Bar that goes accross the report called Page Header so that it turns black.  That will give you the properties for the Page Header, so select the Event Tab and then click inside the On Format option.  A little button appears on the right hand side with three dots on it, this is called the Builder button.  Click on that little button and a window opens up.  Select code builder from the window.

This will generate an onformat sub in the code window that will be similar to this:


Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

End Sub

Then all you have to do is type this in betweenthe two lines above so that you have this

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
Cancel = Not [Page] = [Pages]
End Sub

Close the code window down and test the form, you will notice that the page header will now appear only once on the first page of the form.

Incidentally you can also use the same method to make the page footer appear only on the last page, this is done exactly in the same way.

Good luck I hope this answer your question

pjcrooks2000



 
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12208967
Can't you just set the report's "PageHeader" property to "Not with Rpt Ftr"?
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:Annu
ID: 12209310
Thanks shanesuebsahakarn.

I tried that but I have a sum field in the Report footer too. The sum is of records in the main report. So when I set PageHeader Not with Rpt Ftr, the sum field and the sub-report start on a new page.

I tried making the main report a sub-report too (so I have 2 sub-reports now, one in the Report Header and the other in the Report Footer), but now I can't get the 1st sub-report to have it's own PageHeader. Any ideas?



pjcrooks2000 and grayderek: I think you misunderstood my question. Hope it is clearer now. Sorry for being unclear.
0
 
LVL 8

Expert Comment

by:pjcrooks2000
ID: 12209341
Annu use put your sums in the page footer not the report footer nad do what I said above.  

But make the control in the page footer, and select the Page footer On Format to add the code exactly the same as above but do it inside the page footer not header as i have mentioned above.

 It works I have been doing it all week :)
 
0
 

Author Comment

by:Annu
ID: 12209379
Thanks pjcrooks2000, but this would my sum appear at the BOTTOM of the page (although only once). I need it to appear just below where the main report finishes, not at the bottom of the page.
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 500 total points
ID: 12209629
Add a new field to your query:

FakeGroup: 1

Create a grouping on the FakeGroup field. This needs to come before all other groups. Now put your sum calculation in the FakeGroup's group footer. Leave the subreport in the report footer, and change report's PageHeader property to "Not with Rpt Ftr" as before. That ought to do it.
0
 

Author Comment

by:Annu
ID: 12210958
Thanks shanesuebsahakarn.

This would probably do it, but then the sub-report will always start on a new page. Isn't there any way to do it so that the sub-report starts immediately after the sums?

I have now made the main report into a sub-report, so I have 2 sub-reports. The main report has no recordset, it just holds the 2 sub-reports. Is there a way to do it this way? Thanks.
0
 
LVL 8

Assisted Solution

by:pjcrooks2000
pjcrooks2000 earned 500 total points
ID: 12211116
If you want the sub report imediately after the sums then is there any need for the sub report to be inside the main report?  I assume your just going to print it off in the end, why not just have two reports?  You can then have both reports open up to be viewed.

Just an idea!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question