Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Margin settings by VBA code

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
Using Access 2000

Here's what I want to do...
1. A two page report, page 1 on front side, page 2 on reverse. Left margin .75 inch, right margin .25 inch
2. When page 2 (the reverse side) prints, I want Mirror margins, the same as is possible to set up in Microsoft Word.

Is this doable?
 
I've seen you post so I know you just need a nudge... Thanks to Access 97 help check out...

GetOption, SetOption Methods

I've never played with it but I'm guessing you could set the margins using an On Format event in your report...

If Page Mod 2 = 0 Then 'If the page is even
'code for even pages
Else
'code for odd pages
End if

I hope
 
THWatson,

Changing margins page-to-page is very difficult, if not impossible. I had bookmarked the following site that shows how to simulate moving margins by moving controls. If your report doesn't have a lot of controls, this might be an option.....

How to simulate odd and even margins (book style) in a report

Si hoc legere scis, nimis eruditionis habes
 
It occurs to me that it may be possible, seeing that this is a two page report, to set the margins using PrtMip then print page one using PrintOut, set the margins again and print page two.
 
CosmoKramer
I'll have a look at the link you suggested.

Remou
I see what you are getting at...but this is a report whihc needs 50 copies printed...and will be run periodically. That complicates things to a certain degree.

Tom
 
Regarding CosmoKramer's link...

If moving the controls conditionally, you might try moving them a fixed amount...


If Page Mod 2 = 0 Then 'If the page is even
dblLeftShift = 720 'twips for .5" assuming .25" Margin
Else
dblLeftShift = 0
End if


Then you can just move each control to a value plus dblLeftShift.

That way it would be easier to maintain the code and experiment (only one line per control instead of 2).

I'm guessing the methods I found are not available during runtime.
 
Oops... either test for odds or switch the statements for the if and else bodies.

If Me.Page Mod 2 = 1 Then 'If the page is odd
 
Depends on whether you have a nice modern printer that will print two sided, I suppose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top