Different page margins for odd and even pages

D

Dorothy

Hi, I would like to set different page margins in a report for odd and even
pages. Is this possible? Thanks.

Dorothy
 
F

fredg

Hi, I would like to set different page margins in a report for odd and even
pages. Is this possible? Thanks.

Dorothy

You can move the left position of each control as needed for
each even page, then back for each odd page.

In the Code Window Declarations section, write:
Option Compare Database
Option Explicit
Dim MoveMargin As Integer
====
Code the Report Header Format event:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
MoveMargin = MoveMargin * -1
ChangeMargins
End Sub
=======

Code the Page Header Format event:

Private Sub PageHeader_Format(Cancel As Integer, FormatCount As
Integer)
If Me.Page = 1 Then
MoveMargin = 0
ElseIf Me.[Page] Mod 2 = 0 Then MoveMargin = 1440
Else
MoveMargin = -1440
End If
ChangeMargins
End Sub
=========
Add a new Sub Procedure to the code window:

Public Sub ChangeMargins()
Dim C As Control
For Each C In Me.Controls
C.Left = C.Left + MoveMargin
Next C
End Sub
====

Change the value of MoveMargin as needed.
1440 = 1 inch.
Make sure there is enough room to the right of the right-most
controls to allow for the movement towards the right.

*** You may wish to make the following change.
In Design View, set ALL the controls left position
to what you wish for the EVEN pages.
Then change the above coding, from:
ElseIf Me.[Page] Mod 2 = 0 Then MoveMargin = 1440
To:
ElseIf NOT Me.[Page] Mod 2 = 0 Then MoveMargin = 1440

Remember... 1440 = 1 inch of movement.
Try it both ways and see if which layout suits your needs better.****
 

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