How to format even numbered pages completely differently than odd pages? (1 Viewer)

zee3are0

New member
Local time
Today, 17:34
Joined
Apr 21, 2011
Messages
2
I have a government standard two page report, but depending upon number of records, it could be as many as 12 pages. On the first page, there is a fairly elaborate header with some dynamic data, pulled from multiple resources. A single line (form number) for a footer.

I have a temporary table that just contains the basic information I need in order to find out how many records go into the main part of the report's first page (the Detail section), and the data I need in order to populate everything else (a series of DAO and Domain Lookups based on what's in the form used to open the report and the names in the temporary table). The temp table isn't an issue at all; the report's on-close event empties the entire table, and the form that opens it also populates it correctly. Never had any bugs with that.

I then use the "Me.Line" function to draw all the borders for the entire page, regardless of how many records contain data. This way it looks like the actual governmental form.

Basically, the first page looks and performs perfectly. The problem is, there is a back page too. And it's totally different; contains some legalese, a signature block, some date fields, etc.

If this report was always going to be only two pages, I'd be fine; inserting a Page Break control in the Report Footer allows me to do everything I want then. But if there are more than 21 names in the table, it needs a second "first page" and both of those "first pages" need a matching back page.

On that back page, it has dynamic data that is only as dynamic as the header on the front page. Right now, if I leave the page break in the Report Footer, and my controls where they are and code as it is, in the case of more than 21 records, I'd have "front page, front page, back page." The report could theoretically contain as many as 100 records, or 6 pages worth of "front pages."

I've learned how to turn the header (and footer) off, as well as to cancel the drawing of the lines that format the sheet on each even numbered page or the last page - programmatically. That was easy.

But there is nowhere I can insert the controls or other data for a second page between each "front" page. I've tried adjusting positions of controls in the formatting events, but that's only going to change the formatting for the header and footer appropriately either; the size taken up by the Detail section repeated 21 times on the front page is the bulk for screen real estate.

Inserting a "Page Break" control into the page footer appears to have absolutely no effect, and even if it didn't, creating a page footer large enough for the second page doesn't allow me to print it either - I get the error that the "sum of the top margin, the height of the page header, the height of page footer is greater than the length of the page you are printing on."

Is the solution going to be creating two subreports, each side by side, where the main report's width is the equivalent of two printable pages, and then going back into code and redrawing everything with an added qualifier (instead of "me.line" make the line "me.subreport.line" and using the code to make sure it's only doing that on even numbered pages) still going to work? Or will the dynamically changing size of the detail section in that sub-report screw up the sizing of the second? Further, will the second page automatically print behind each first page? I don't want to try that (because it's a TON of work) if someone knows if it's going to fail, or that there is another, more elegant solution... Just changing the control names to add a ".subreport." between the "me.line" didn't work anyway when I tried it kind of "roughly" - none of my page header data showed up, and the lines didn't draw in the correct spots because the "section(0).height" and "section(3).height" data doesn't have valid data in the subreport that can be used at runtime in the parent report. Or if it does, I don't know how to get it.

Other solutions "outside the box" would be nice. I've thought about exporting each page of the report to a PDF, but we don't have a distiller on each computer (this database application has to be able to run on several hundred computers with their given licenses), so that isn't a real option either. On the other hand, if there is some sort of way to "export" the formatted page for printing to a PDF, and do a for loop that will append the second back page each time, I could automate that and then open the report in Acrobat. I'd need some example code if that's possible. But again, without a commercial distiller, I don't see that as a viable option.

Any suggestions?
 

zee3are0

New member
Local time
Today, 17:34
Joined
Apr 21, 2011
Messages
2
Just in case anyone else ever tries to do this, there's a simple fix...

If you know how many pages you're going to have of the "front" of the report, just do what I did:

1. create a temporary table. Data inside it is irrelevent. Single field, call it whatever you want.
2. in the form that invokes your report, have it create an entry in that second table for each page in the front.
3. in your "parent" report, make the width approximately two pages wide. On the left half, create a sub-report that takes up the entire size of your page (minus the header/footer) for your "front page." On the right half, create another subreport that has a single hidden control - the temporary table's single field name. Then insert your legalese there.
4. in the report's on_close event, do a sql command to delete all data in your temporary table.

Remember, the header and footer size on the front page will be the same as the back page, but you can make them be different if you wish; if you want to have the page numbers print on one side the page on the "front" and the other on the "back" it's easily done, and the page numbers are still accurate, because that's a code calcuation that is based on page size.

You may have to play with your margins and movement of your controls to make it look perfectly front/back.

In "report view," it's going to look weird, so don't even bother. You might as well make a second report for that. This is purely to make a printed one look perfect front/back page wise for duplexing to a printer.

For me, I knew my front page could have a maximum of 21 records displayed. Every time I counted the 22nd record (#22, #43, #64, etc.), I'd add an entry to the "back page" table.

Worked perfectly. I now have a back page with the data I need on it.

Your mileage may vary, but I noticed other people have asked this question and never gotten an answer. I asked it too, on this forum and others, never got an answer, but figured it out on my own. Now, if anyone else ever has the problem, this may be the solution for you.
 

Users who are viewing this thread

Top Bottom