Hi, apologies to the newsgroup; I've been pestering it alot in the last
couple of days.
But, one more question. I would like to have a report print with
alternating left and right margins for the proverbial report binding
issue. Is there a way to do this? Or, maybe I would better express this
as: "What is the best way to do this?"
Thank you, everyone, for your help in advance!
Darrell
As I often adapt code for a particular purpose, I haven't checked that
this is accurate in a very long time.
Try it. You may need to make a few changes.
You can move the left position of each control as needed for
each even page, then back for each odd page.
In the Code 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.****