conditional page breaks

L

Lydia

I need to send bill notices to customers. I have the queries and
reports ready to go. Currently we are printing the notices single-
sided since the notices are of variable length - many are single pages
but some may be two or three pages. Is it possible to get Access to
start the next notice on the next page if "this bill" ends on an even
page number (the back of a page) and to insert a blank page when the
bill is only one page long?

Lydia
 
A

Allen Browne

I imagine your report has a Group Header on the NoticeID, the Detail section
printing the line items, and a Group Footer giving the total for the
customer. In the Sorting And Grouping box, add the NoticeID a second time,
and in the lower pane set group footer to Yes. This gives you a second
NoticeID group footer section on your report.

Set the Set Force New Page property to None for the group headers, and After
Section for the group footers. Now add code like this to the report's
module:

Option Compare Database
Option Explicit
'Start notice on odd page (duplex printing)
Private mbWasOddPage As Boolean

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
mbWasOddPage = (Me.Page \ 2 <> 0)
End Sub

Private Sub GroupFooter3_Print(Cancel As Integer, PrintCount As Integer)
Me.Section("GroupFooter1").Visible = mbWasOddPage
End Sub

What that does is to examine the page number in the first group footer (i.e.
at the end of the actual notice), and set a flag (mbWasOddPage) if it is on
an odd page. then in the Format event of the 2nd group footer, it examines
this flag, making this section visible only if it was previously an odd
page. If the 2nd footer is not visible, the page break after this 2nd footer
does not get printed. So either way, the next one starts on an odd page.
 
A

Allen Browne

Sorry. You need to use the Mod operator.

The line in GroupFooter1_Format should be:
mbWasOddPage = (Me.Page Mod -2)
 

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