Link to home
Start Free TrialLog in
Avatar of mjustman
mjustman

asked on

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
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

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
ASKER CERTIFIED SOLUTION
Avatar of tomk120999
tomk120999

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of tomk120999
tomk120999

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...
Avatar of mjustman

ASKER

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
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
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
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
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...
Sorry, should have said "OnPage event for the *report*:"
Tom,

  Yes, that's what I had in mind.

JimD.