Assigning Printers and setting margins

G

Guest

Is there a way to change/set a reports printer assignments and margins
programmically?

I have several database systems that have an Access front end with a SQL
datasource. When updates are made to the front-end users will copy the file
to their system. The problems lies with the many labels. There are several
different label printers and label sizes. The defaults are set to the most
common printers, but this always leaves many users whinning. I have provided
training and documentation to users so they can easliy make the changes them
self, but still the flood of requests come after every update. Any help
will be apprieciated, thanks.
 
A

Allen Browne

Access 2002 and later have a Printer object. Assign Application.Printer
before you OpenReport, and the report (and any others before you reset the
Printer object) will go to that printer.

That means you can create a custom property for the report to remember the
printer this particular user wants to use for this report. There's a
downloadable example that does that here:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html

Re setting margins, again, you can do this in Access 2002 and later. The
SetMarginsAndOrientation() function at the end of this page illustrates how:
http://allenbrowne.com/AppRelReportCode.html

If you are working with older versions, or if you need to do more than those
2 things, you may need to work with the rather cryptic PrtMip property.
Unfortunately, this means the report has to be opened in design view, and so
this approach is not suitable if you are using an MDE or a runtime version.
If you want to go that way, see:
http://msdn.microsoft.com/archive/d...umControllingYourPrinterinMicrosoftAccess.asp

Your post also refers to "different labels." This suggests you want to open
the report in design view and change the number of columns, the Height of
the Detail section, the placement/size of the text boxes in the Detail
section, etc. PrtMip includes an ItemsAcross which is the number of columns.
It's going to get fairly involved though, particularly where some
tractor-feed printers support zero margins top and bottom while others do
not. Sounds like quite a challenge, and I think most developers would
consider the loss of MDE functionality signficiant.
 

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