Access, please give me more blank pages! (1 Viewer)

Mean Dean

Registered User.
Local time
Today, 15:18
Joined
Apr 28, 2008
Messages
15
I have the opposite of the problem everyone else seems to have with blank pages, i.e. I want one and Access isn't giving it to me ;)

The issue is that I need a report to have an odd number of pages. (The reason for this is that the report is going to be printed double-sided, stapled, and given out to people to fill out by pen. After they do so and give it back to us, the last page of the report then needs to be separated and dealt with separately.)

The footer already has "Force New Page - Before Section" set. In order to force another new page if needed, I began the footer with a page break called "OddNumberofPagesPageBreak", and wrote this code:
Code:
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim PageCount As Integer

PageCount = [Reports]![CourseEvalForm].[Page]

If (PageCount Mod 2) = 1 Then Me.OddNumberofPagesPageBreak.Visible = False

End Sub

This looks like I want it to in print preview... but it doesn't print out that way! The blank page is ignored on printout.

Help, please??
 
Last edited:

vbaInet

AWF VIP
Local time
Today, 20:18
Joined
Jan 22, 2010
Messages
26,374
Remove the page break and use:
Code:
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    If FormatCount = 1 Then
        If Me.Page Mod 2 = 0 Then
            Me.ReportFooter.ForceNewPage = 1
        Else
            Me.ReportFooter.ForceNewPage = 0
        End If
    End If
End Sub
The problem is you will need to number the pages yourself.
 

Mean Dean

Registered User.
Local time
Today, 15:18
Joined
Apr 28, 2008
Messages
15
Yup, I must not be getting it because I plugged that code in, and now odd page numbered reports are missing the last page*, while even page numbered reports don't have the page break I need. What do you mean by "numbering the pages myself"? That must be what I'm missing.

* I might need to point out that the footer does contain text that needs to be printed (that last page that I described).
 

vbaInet

AWF VIP
Local time
Today, 20:18
Joined
Jan 22, 2010
Messages
26,374
Don't go by the page numbers that you see. If you have [Page] and [Pages] in your report, [Pages] will not show the correct number of pages if you programatically forced a new page when [Pages] is even. If that makes sense?

Did you remove the page break that I mentioned you should remove? Do you have other page breaks on your report?
 

Mean Dean

Registered User.
Local time
Today, 15:18
Joined
Apr 28, 2008
Messages
15
Don't go by the page numbers that you see. If you have [Page] and [Pages] in your report, [Pages] will not show the correct number of pages if you programatically forced a new page when [Pages] is even. If that makes sense?
I guess, but this is the only part of the report where I refer to page numbers, so do I need to worry about it?

Did you remove the page break that I mentioned you should remove? Do you have other page breaks on your report?
I did, yeah. I do have other page breaks. The structure of the report is:

Part I, Section A (this is always 1 page)
* page break *
Part I, Section B (this is always 1 page)
* page break *
Part II (this may have multiple sections, and varies in length)
* page break (created by "Force New Page - Before Section" in footer) *
Footer (this is the page that needs to be separated from the report after it's been filled in by pen)
 

vbaInet

AWF VIP
Local time
Today, 20:18
Joined
Jan 22, 2010
Messages
26,374
A textbox with a control source containing [Page] and [Pages] must exist for the code to work.

I suspect that your page breaks are messing up with the code. Why the page breaks? Why not Grouping?
 

Mean Dean

Registered User.
Local time
Today, 15:18
Joined
Apr 28, 2008
Messages
15
I wasn't grouping because I didn't want the page breaks between the sections in Part II. I only wanted page breaks between the sections in Part I, and then one at the end. (See my previous post if these terms are unclear.) If there's a way to do this with grouping, then certainly I'd be open to that; just tell me :)

I tried putting textboxes equal to =[Page] and =[Pages] in both the detail section and the footer section. Although this solved the problem of the final page being cut off in odd-page-numbered reports, it did not achieve the goal of adding a page break before the footer to even-page-numbered reports.

Not really sure what I'm doing, here...
 

vbaInet

AWF VIP
Local time
Today, 20:18
Joined
Jan 22, 2010
Messages
26,374
Like I mentioned in my previous post, the page breaks you put are causing undesired results. Remove them and work with groupings instead.
 

Mean Dean

Registered User.
Local time
Today, 15:18
Joined
Apr 28, 2008
Messages
15
Okay. When I do the grouping, how do I tell it to put page breaks after some of the sections, but not others? (see my post #5)
 

Mean Dean

Registered User.
Local time
Today, 15:18
Joined
Apr 28, 2008
Messages
15
Okay, I wasn't really sure how to do this... I'm gonna try to post it here.

If you open the "CourseEvalutionQueries" form, select the "Fall 2011" semester, select course "SW 650 Ba", and hit "Create Course Evaluation Form for this Course", you should see an example of a 4-page report (the type for which I need to add a blank page before the footer). If you select course "SW 660 OL" instead, you should see an example of a 5-page report (the type that is fine the way it is, since the footer prints on a separate page we can tear off.)

Thanks, and please let me know if this isn't what you needed.
 

Mean Dean

Registered User.
Local time
Today, 15:18
Joined
Apr 28, 2008
Messages
15
That seems to be working! Thank you so much!!!

Thanks also for the tip about the forum. Did you mean that I should have taken screenshots of the report in design mode, and attached those images?
 

Users who are viewing this thread

Top Bottom