Faking page headers on a Microsoft Access subreport

In a tedious Microsoft Access report featuring pages and pages of meaningless numbers in a table you quite often want the table headings (the bit labelling the column) to repeat itself at the top of each page. That way the recipient has no excuse for not knowing what a hundred pages of mind-bogglingly dull numbers mean.

Normally Access provides a Page Header section of the report for exactly this purpose. If you can't see it then in the report design view, go to the View menu and select "Page Header/Footer". Whatever you write in this section will appear at the top of each page.

This falls down if the report you're writing is to be a subreport in another report and you want the same behaviour. You can still design the page header, but when you see the final report as a subreport inside another report it won't be there - Access just ignores it. Yay.

However there is a simplish workaround (much more simple that whatever Microsoft's solution is supposed to mean).

Whilst in design view of the subreport, use the sorting and grouping box to add a new group level. If you can't see the box, go to the View menu and choose "Sorting and Grouping". As the top level of the grouping (i.e. first row on that box), rather than group by a field, set the "Field/expression" column to something non-variable, a suggestion being "=1" without the quotes. At the bottom of that window, select to have a group header. This will then give you the equivalent of a Report Header, whereby you get a group header that appears at the top of the report without affecting your data. Whoo.

The magic occurs when you bring up properties of the group header. If you can't see the properties box, go to the View menu then Properties. Then click on the little grey box on the report to the left of the grey line that reads "=1 Header" - assuming you went the =1 suggestion. One property is "Repeat Section". Change this to say Yes. Now add whatever text, controls and so on that you would have put in the Page Header the header of this group (i.e. the blank bit of report directly below the "=1 Header" line.

Save your report, open the main report with it as a subreport, and you will see that the equivalent of page headers are shown. Job complete.
Artist's impression: What it should look like when you're doneArtist's impression: What it should look like when you're done


Comments

This acutally works

wow. (Y)

Well it didn't work for me

Well it didn't work for me :( It did the same has if I had put that line in my detail... It kept repeating itself interbedded with a row of data. So I had header/data/header/data.....

Any suggestion?

Wow this is working for

Wow this is working for sure. I had never thought that it is so easy to fake those page headers in Microsoft access. This application is hard to work with, so every extra information that is provided in blogs like this - is a real help for us (students). Thanks for the great article one more time and I will be definitely waiting for other great publications from you in the nearest future.

Brad Pollson from instant payday loans

Worked great, thanks!

Worked great, thanks!

Thanks for that

Used Access for 10 years and have only just found this problem.
Nice simple solution, thanks very much.

Agreed, great little

Agreed, great little shortcut for an extremely tedious problem.

No problem, glad it helped.

No problem, glad it helped. It would be nice if they could just build in such a feature of course!

Incase you already have a sorting criteria...

Just figured out there was a problem following these steps when a sort criteria already exists in the sort list. If this is the case for you, follow the steps as suggested here, then:
- select the group row from the "Sorting and Grouping" popup box
- drag it and drop it to the top of the list

This will prevent the header appearing before every group of rows sorted by the preceding criteria.

Great, thanks for the tip!

Great, thanks for the tip!

thank you

ahahahah! I am jumping all over the place, you are a genious! I just posted a message that it didn't work for me but I had another sorting criteria. Now it works beautifully!

Cheers

Thanks!

Thank you for the clear explanation and screenshot. I ran into this Access problem for the first time just 5 minutes ago, and I found the fix right here.

No problem, glad it helped!

No problem, glad it helped!

Thx a lot

nice solution, much appreciated!

This works beautifully!

This works beautifully! Thanks!

Faking headers in subreports

You are a god!!!!!!!!!!!!!!!!! And I love the way you write. I was looking at that macro stuff explaination on MS website and thinking I was doomed. So glad your site popped up on my internet search!!!!!!!!!

my subreport uses columns

my subreport uses columns how do i use the fix?

My wife loves you

You just saved me at least 10 hours of work! You're the bomb! I'll actually see my wife tonight thanks to you!

Glad to be of service.

Glad to be of service. Saving marriages is all part of the special Feb 29th service here!

This is genius...

Thanks so much...this solves a big problem for me.

Faking page headers on a Microsoft Access subreport

You're a God send.

Thanks a million

Peter
Lynwood
Western Australia

very good much appreciated

very good much appreciated but why is access being so difficult in the first place?
is there a better database application available?

also does any one have a

also does any one have a decent way of making the microsoft access application window disappear when the database loads, so that the database looks like a professional stand alone application when used? i downloaded some code that someone created as a module to do this, but there must be a better way?
Thanks in advance my little geniuses!!!

Faking subreport headings

Unbelievable. First, MS designs this "flaw", then you provide a stunning work-around. It is elegant; it is perfect.

I thank you. My clients will thank you. This qualifies for my "learn one new thing every day" rule.

Kudos, and thanks again.

Oh, and did I say, "Thanks"?

Thanks!

Wow, you just saved me a lot

Wow, you just saved me a lot of time and a big headache!

Genius!!!!!

Genius!!!!!

Fab!

15 years access experience and only just hit this issue - and on the most important reports I've ever needed to produce! Thanks a million!

Access Subreport Page Headers

Very many thanks. You saved me having to struggle on for another hour or so !

kudos!

Thanks a lot for your important contribution - kudos.

Header problem fixed

Whoohey, thanks allot dude... This really worked out great.

It so simple!!

Thanks for documenting this solution in an easy problem/solution format.  I might not remember this solution next time I need it, but just know it exists make me feel so good! 

Page header missing after 1st page

think this is because it is still part of the same group ie "=1". Any ideas?

Wow this works

Thanks so much. Solved a minor headache for me and once again beats the pants off of MSFT's solution.

Doesn't it just! Thank you

Doesn't it just!

Thank you very much for the help and instruction. It is very much appreciated!

Thanks for the help

Thanks for the tip

Great!

Thanks for this explanation. I kept on playing around with the form/subform thinking I was missing something. Glad
to know if was an Access error and not me! Can't believe I spent 3 hours blaming myself! ;-P Thanks
for your quick and easy fix.

Great write up! Thanks!!!

Great write up! Thanks!!!

Awsome

Thanks a ton for an elegant solution to another one of those head scratchers that Microsoft Access so often presents us with. AWSOME!

Saving my time at Last!

Thanks a Million, no need to scratch head for the access script just to get repeated page header to the other side..since im creating a 2 side data into 1 page...

Thanks muah muahh (^ _ ^)/
http://allaboutads-makemoney.blogspot.com

Thanks!!!

Thanks so much. Great write up!

Awesome , this worked!

Awesome , this worked!

Thanks, you are a genius

Thanks a lot dude, I have been head breaking about this issue and this just saved my day.

xvxv

Just figured out there was a problem following these steps when a sort criteria already exists in the sort list. If this is the case for you, follow the steps as suggested here, then:
- select the group row from the "Sorting and Grouping" popup box
- drag it and drop it to the top of the list

This will prevent the header appearing before every group of rows sorted by the preceding criteria.

Bravo!

You've really been helpful. You're right about the bizarre Microsoft workaround. Well done, and thanks.

Thnaks for your overview

The best way to handle this is to force a new page after a set number of records have printed. I have done this and it works.

The first step is to create a few formulas to keep track of your record counts.

//@reset_var
whileprintingrecords;
numberVar record_cnt := 0;

Place the above in your group header in the subreport. We want to reset the variable every time the group header prints.

Next, create this formula to increment the counter for each record, and place the formual in your details section:

//@increment_var
whileprintingrecords;
numberVar record_cnt := record_cnt + 1;

Now, the next step is to determine who many records comfortably fit on one page.
Once you have determined that, go to Format, Section.
Highlight details, and click the X+2 button next to the New Page After property.
In the formula editor that opens and this line:

{@increment_var} = 20 // replace 20 with the number of records that fits you report

You also must make sure that you have the "Repeat Group Header on each page" option set.

Give it a try. Let me know if you have anyother issues with it.

Awsome

Thanks a ton for an elegant solution to another one of those head scratchers that Microsoft Access so often presents us with. AWSOME!

Thanks for your Overview

The problem is that your fakeheader is actually a group header. You can't force a group header to print before a page footer because if the combined group header/footer exceeded the length of a page then you'd be caught in an endless loop.

I believe you've just run into a limitation of the workaround and AFAIK there's no way to correct this.

wow gold

You've really been helpful. You're right about the bizarre Microsoft workaround. Well done, and thanks.

My question may be silly,

My question may be silly, but please help as my school assignment's deadline coming up. I'm using MS Access 2007 and can't find the place to set the "Field/expression" and Repeat Section field. Please helppppp

Hi - unfortunately I don't

Hi - unfortunately I don't have a copy of Access 2007 so can't answer for sure...but in Access 2003 it is under the View menu, under "Sorting and Grouping" if there is something similar in 2007?

Actually, looking at a couple of other blogs, it seems there is a "Group, Sort and Total pane" with similar looking options.

You can also create and/or modify groups manually by clicking the Group and Sort button on the Grouping & Totals group on the Design Ribbon. You can then create groups and add a group header and group footer to your groups by setting properties in the Group, Sort & Total pane.

Quoted from PCM CourseWare

Good luck!

THANKS HEAPS Yes, I got it

THANKS HEAPS
Yes, I got it - Wow! you can answere any questions of us. You are my angle.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <del> <p>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You may use [acidfree:xx] tags to display acidfree videos or images inline.
  • Images can be added to this post.

More information about formatting options