reports: moving left margin L/R for binding

Using Access from Office '97, is there any way to make the ENTIRE PAGE shift left or right depending on whether it's an odd- or even-numbered page?

I have code which does this nicely for a footer control, but in addition, I need to shift pages to create a binding margin.

I think I've read that there are 3rd party tools that do this.  Assuming this is necessary (i.e., that Access can't, or it's a terribly tricky setup), what are they? where do you get them? How do they work? Is one better than another?

Thanks.

Marilyn Justman
mjustmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Marilyn,

  Neat problem.  It certainly is doable.  It's a matter of adjusting the .Left property of each control based on the page in the OnFormat event of the page header.

  It should be fairly easy to write a callable function to do that.  I don't have anything like that on hand or I'd post it, but I'll try taking a swing at it over the weekend.

JimD
0
tomk120999Commented:
Marilyn, JimD is correct.  I took a few minutes and the following works fine.  Two things, make sure your page layout has enough room to move things to the right, and if your page 1 is on the "Right" side when bound, change the "+"'s to "-"'s and vice versa.  The code below assumes that Page 1 will be on the left as bound.  Too bad Access doesn't have pleading like Word.

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo Err_FFmt

    If Me.Page = 1 Then GoTo Exit_FFmt  'Odd page position is set at design
    Dim ctlControl As Control
   
    If Me.Page Mod 2 = 0 Then 'page is even
        For Each ctlControl In Me.Controls   ' move all controls right for Pg2, 4, 6...
            ctlControl.Left = ctlControl.Left + 0.25 * 1440   'for twips to inches
        Next
    Else
        For Each ctlControl In Me.Controls    'move all controls left for Pg3, 5, 7...
            ctlControl.Left = ctlControl.Left - 0.25 * 1440   'for twips to inches
        Next
    End If

Exit_FFmt:
    Exit Sub
   
Err_FFmt:
    MsgBox Err.Description & ", " & Err.Number
    Resume Exit_FFmt
   
End Sub

JimD's idea was right on.
HTH, good luck as usual...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Tom,

  Nice job, but I was thinking of something a little more generic so it would be callable from any report.  You might want to carry that a bit futher.  Be a nice function to have in the toolbox so to speak<g>.

Marilyn:

  Make sure you give Tom the points on this one.

JimD.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

tomk120999Commented:
JimD, good idea!

Public Fuction ShiftPage(ReportName as String, Amount as Single, Direct as String)...you get the idea.

Call from report page header OnFormat:
ShiftPage(Me.Name, .5, "+")...

something like that?  I hope so. :)  We'll try it Monday.

good luck as usual...
0
mjustmanAuthor Commented:
I haven't tried it yet, but it's gotta work ... and if not, I'll complain to you, right???

BTW:
1-Your afterthought was correct: All Latin alphabet books (not those in Semetic alphabets, which are "left-handed"), are bound on the left, therefore the first page is ALWAYS RIGHT. As you say, I will set my model page up as if it's right, and subtract for even numbered pages. (or? should I center it and both add and subtract? I'll figure that out.)
2-I'm perfectly happy working in twips.
That was one of Billy Boy's truly clever inventions way back in 1984 or so (Word 2.0?) still adequately precise even for 1200-dpi printers!
3-I've already got a little IsEven function going (for the footer position swap).  If this works first time, maybe I'll play with it and try to use that function here, too.

Thanks again.

Marilyn Justman
0
tomk120999Commented:
Thanks for the points, Marilyn.  Just a little discussion on your reply:

1.  I was thinking "set and move and then move back" seemed simplest.  Also if you have a title page, then page 1 is actually page 2 (I think).
2. IMHO, Billy Boy is a weasel.
3. Great!  Feel free to put a "runnin' iron" on anything I send.

I don't take complaints 'cause I don't consider constructive criricism as complaints.  Glad I could add something to the discussion.

good luck as usual...
Tom Killgo
0
mjustmanAuthor Commented:
To tomk:

1-no complaints. It works. Had to take "section" out of the event title...it's just PageHeader_Format, if I recall...
2-In the book business, there's a wad of front matter that can go before p.1 - title, half-title, toc, preface, etc. ...and (you could probably do this is Access, but let's hope we never have to) they can get various different numbering systems....BUT the first page of real body text is always RIGHT and it's always page 1, even if sometimes it doesn't carry a folio (number). Right Pages are ALWAYS ODD numbers. One of the few predictable truths in this world.

Thanks again.

mj
0
tomk120999Commented:
Thanks, for the education.  I've done a few pamphlets, but never much real publishing.  I was working on the 'generic' version, and, because of your remarks, I think I'll give it a little more thought before I consider it worth posting.  Thanks again.

Tom
0
tomk120999Commented:
Ok, MJ, I had some thoughts, but simpler seems better.  the generic function:

Public Function ShiftPageLR(RptName As String, Amt As Single, LR As Integer)
On Error GoTo Exit_ShiftPageLR
       
    Dim ctlControl As Control
    'this could be Select Case structure, but IMHO won't gain anthing...
    If LR = -1 Then
    'anything but 1, -1 exits without doing anything,
    '  and I like the idea of showing + and - to remember direction.  Also
    '  no quotes are needed when calling the function.  I'm a lazy typist.
        For Each ctlControl In Reports(RptName).Controls    ' move all controls left
            ctlControl.Left = ctlControl.Left - Amt * 1440  'for twips to inches
        Next
    ElseIf LR = 1 Then
        For Each ctlControl In Reports(RptName).Controls    'move all controls right
            ctlControl.Left = ctlControl.Left + Amt * 1440  'for twips to inches
        Next
    End If

Exit_ShiftPageLR:
    Exit Function
   
Err_ShiftPageLR:
    MsgBox Err.Description & ", " & Err.Number  'Use for debug only
    Resume Next

End Function


And the call would be from the OnPage event for the form:

Call ShiftPageLR(Me.Name, 0.25, 1) for shift right and:

Call ShiftPageLR(Me.Name, 0.25, -1) for shift left.

Is that what you had in mind JimD?  I've tested this and it works for me.
good luck as usual...
0
tomk120999Commented:
Sorry, should have said "OnPage event for the *report*:"
0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Tom,

  Yes, that's what I had in mind.

JimD.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.