Setting Report Margins in VBA

G

Guest

Is it possible to set report margins in VBA? The reason why I want to do
this is because the database is on a network drive access by multiple users
that have different margin settings due to different printers being used.

Thanks.
 
A

Allen Browne

If this is Access 2002 or later, you can set the margins of the Printer
object.

The value is in twips, where 1440 twips = 1 inch.
Therefore to set 1/2 inch margins for the report like this:
Dim lngMargin As Long
lngMargin = 720
DoCmd.OpenReport "Report1", acViewPreview
With Reports!Report1.Printer
.TopMargin = lngMargin
.BottomMargin = lngMargin
.LeftMargin = lngMargin
.RightMargin = lngMargin
End With

It is considerably more difficult with older versions, but here's the link
if you need it:
http://msdn.microsoft.com/archive/d...umControllingYourPrinterinMicrosoftAccess.asp
 

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