Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Insert Blank Page in Report After Each Category 1

Status
Not open for further replies.

currie

Technical User
Dec 19, 2001
6
CA
I am creating a report that is based on various different categories of information (example: Airports, Fire Departments, Police Stations are all "categories").
For each category, there are a varying number of records. For example, Airports may have 5 records, Fire Departments may have 13 records, etc. What I need to do is insert a blank page after each category if that category ends its output on an odd-numbered page. IE: If there are 5 records for Airports, one per page, then pages 1-5 (double-sided) would be printed out with the info on them.

The problem is, on the back side of page 5, the first result from the next category would be printed. If updates are made to the "Airports" section, you would have to replace the entire paper-version of the report to update it, rather than simply being able to replace the "Airports" category.

Any help greatly appreciated,


- Ryan
 
Ryan,

This might work.
1. Group your report by the categories field with a group footer (it can be empty)
2. In the group footer's properties force a new page after section.
3. In the detail section's properties force a new page after section.

Eric
 
Ok, this is what I've come up with.

In the page header, I'm going to add code that does this:

round((detail_count / 4)+0.25)

Thus the result from this will be the page number. Now, I need to know if here is a VB function to determine if the number is even or odd? On odd-numbered pages, I want to insert the blank page, and on even-numbered pages I don't need to.

Any suggestions?? Or a better/easier method perhaps?


Thanks!


- Ryan
 
Hi Ryan,

I was trying to do exactly what you are doing (if the category ends on an odd page, insert a blank page so the next category starts on an odd page).

I did this by:

1) Create a category footer to go with the category header. Don't worry - it won't mess up the formatting.
2) Insert a page break anywhere into the category footer.
3) In VBA, insert the following code for the Format portion of the footer:

Dim intPageNum As Integer

intPageNum = Me.Page

If intPageNum Mod 2 Then
Me![PageBreak34].Visible = True
Else
Me![PageBreak34].Visible = False
End If

This simply toggles the pagebreak at the end of the category based upon whether or not the current page returns a 1 or 0 when you Mod by 2 (odd numbers always return a 1).

If you need to switch where the page break occurs, simply switch the true/false.

PS - with this, there is no need to mess with "Force New Page".

Hope that helps!

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top