Setting the margin width of a report by code

  • Thread starter Screaming Eagles 101
  • Start date
S

Screaming Eagles 101

Hi,
we have set the margin width of a report to the minimum possible on PC "A"
(in the page properties)
and then we sometimes copy the mdb to a different computer "B", to change
that report design,
then after copying the mdb back to "A" the margin settings are gone (we get
a lot of white labels again).
In the page properties we have to apply the 'minimum' settings again.

Can I avoid this by applying these settings by code, instead of manually ?
 
A

Allen Browne

In Access 2002 and 2003, you can use the Printer object to set the margins
after the report is open in preview:

Const lngcMargin = 720
With Me.Printer
.TopMargin = lngcMargin
.BottomMargin = lngcMargin
.LeftMargin = lngcMargin
.RightMargin = lngcMargin
End With

The margins are in twips, where 1440 twips = 1 inch, so the example above
sets half inch margins.

With earlier versions, you can get at these properties through PrtMip, but
it is more involved. Details:
http://msdn.microsoft.com/archive/d...umControllingYourPrinterinMicrosoftAccess.asp
 
S

Screaming Eagles 101

Allen Browne said:
In Access 2002 and 2003, you can use the Printer object to set the margins
after the report is open in preview:

Const lngcMargin = 720
With Me.Printer
.TopMargin = lngcMargin
.BottomMargin = lngcMargin
.LeftMargin = lngcMargin
.RightMargin = lngcMargin
End With

The margins are in twips, where 1440 twips = 1 inch, so the example above
sets half inch margins.

With earlier versions, you can get at these properties through PrtMip, but
it is more involved. Details:
http://msdn.microsoft.com/archive/d...umControllingYourPrinterinMicrosoftAccess.asp


PERFECT THANKS !!
 

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