Blank Page at Odd-Numbered-Pages

S

S

Hi,

I have a report which displays Customer Details for huge number of
Customers.
I use double sided printer but I do not want reports of two different
customers to be printed on same paper (front and back). So I need to have a
blank page printed out whenever a customer report ends on odd-numbered-page
(so that new Customer's Report starts on a odd-numbered-page, i.e. on a new
paper).

For the same I wrote:

Public temporaryCustomer As String

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Me![MyPageBreak1].Visible = False
temporaryCustomer = Me!CustomerNumber
End Sub

Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)
Me![MyPageBreak1].Visible = False
If temporaryCustomer <> Me!CustomerNumber Then
If Me.Page Mod 2 = 0 Then
Me![MyPageBreak1].Visible = True
End If
End If
temporaryCustomer = Me!CustomerNumber
End Sub

The result of the code is as follows:

Customer Number Actual Pages Need Blank Page Geetting Blank
Page
Customer1 3 YES
NO
Customer2 1 YES
YES
Customer3 1 YES
YES
Customer4 2 NO
NO
Customer5 2 NO
NO

Problem:
1. I do not get a desired blank page after Customer1
2. Customer 2 starts on wrong page
3. Although I get desired blank pages for all customers except Customer1,
they all get printed on wrong sides of the paper as Customer1 does not leave
desired blank page.

Can anybody help me solve this problem?
Thanx a million in advance.
S
 
M

Marshall Barton

S said:
I have a report which displays Customer Details for huge number of
Customers.
I use double sided printer but I do not want reports of two different
customers to be printed on same paper (front and back). So I need to have a
blank page printed out whenever a customer report ends on odd-numbered-page
(so that new Customer's Report starts on a odd-numbered-page, i.e. on a new
paper).


You can not rely on a report's event procedures to be
executed in any particular order so your attempt to
determine when the report is processing the next customer
can fail.

Instead you should create a group (using Sorting and
Grouping on View menu). Then you can put the page break
control at the top of the group header section section. The
code in the group header's Format event would simply be:
Me.MyPageBreak1.Visible = (Me.Page Mod 2) = 0
 
S

S

Dear Marsh,

As advised, when I added Customer Group Header and a pagebreak in this
header, I got desired blank pages.

Another Issue::
I also have fields on Page Header - CustomerID and CustomerName.
(These needs to be displayed on each page, and cannot be moved to Group
Header and displayed on the first page of each customer)
But I still have following problems:
1. On the blank pages, report displays these fields for the next Customer.
Can this be changed to the current customer?
2. Can the Page Header itself be ommited only from the blank pages?

Thank you in advance.
S
 
S

S

Hi,

Can any one help on the below problem?
I tried but since PageHeader_Format executes before any GroupHeader_Format
Events, I could not get desired result.
Any help on this would be highly appreciated.

Thanks in advance.
S
 
M

Marshall Barton

I think you can deal with that issue by using the group
footer to make the page header section invisible:
Me.Section(3).Visible = False

Then the page header section can make itself visible again
on the next odd numbered page:
Me.Section(3).Visible = (Me.Page Mod 2) = 1


An alternative you might want to try is to move the page
break control to the bottom of the group footer section and
change the code to:
Me.MyPageBreak1.Visible = (Me.Page Mod 2) = 1
This will produce an empty page when the report ends on an
odd page number though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top