changing printer - 2nd post

  • Thread starter Thread starter Newbie
  • Start date Start date
N

Newbie

Hi,

I have a custom sized label for a dot matrix printer that I want to be able
to print on any dept printer that is selected.

My problem is that even though I can change where to print to it does not
always use the correct paper size

What am I doing wrong?

here is a code snippet - using a select case to set the correct department
printer

Select Case frmLocation.Value
Case 1 'Purchasing office
Set prt = Nothing
Set prt = Application.Printers(\\compname1\LabelsGRN")
Set Application.Printer = prt
case 2 ' Accounts
set prt = nothing
set prt = application.printers("\\compname2\LabelsGRN")
end select

With prt
.PaperSize = acPRPSUser
.Orientation = acPRORPortrait
End With

' Set report's printer to selected printer.
docmd.openReport "rptLabelGRN",acViewPreview,,,acWindowNormal
Reports("rptLabelGRN").Printer = prt
DoCmd.Close acReport, "rptLabelGRN", acSaveYes
DoCmd.OpenReport "rptLabelGRN", acViewPreview, , , acWindowNormal
 
New:

When you define a user specified paper size, printers also expect to receive
a specification of what that paper size is. What acPRPSUser tells the
printer (in its DevMode, in Access part of the .prtDevMode property) is that
it should look to two elements, called the dmPaperWidth and dmPaperLength of
the DevMode to get the actual dimensions of the paper. If these dimensions
aren't already embedded and saved with the report, then when you set to
acPRPSUser, the printer doesn't have any idea what the paper size should be
and therefore defaults to its "default" paper size.

Access Xp (and 2003) do not expose the paper height and paper width through
the printer object. It can only be accessed through the .prtDevMode
property of the report. If you want to stop by our web and look in the Code
and design Tips area, under reports, you'll find a tip called "How to Assure
Proper Page Orientation and/or Paper Size for A Report Run On Different
Machines"

This tip contains the code you'd need to embed the paper size you want into
the report.
 
Thanks for this . . . however
I am using Access 2002 - Your webpage says I don't need to use the code as I
can set the page from within access - how do I do this?

Also it says to open the report in design mode - my users will only have
access runtime - can I open the report in design mode?
 
New:

1.) Most of the .prtDevMode elements are available as properties of the
printer object in Access 2002; however, paper height and paper width just
are not available that way so you have to use code like we've posted; it'll
work fine in A2002 (and 2003 for that matter.)

2.) Using the run time isn't a problem it just hides the fact that report is
open in design. The challenge or problem would occur if you db is converted
to an mde database; wherein you can't get to design mode period.
 
Thanks - works a treat



SA said:
New:

1.) Most of the .prtDevMode elements are available as properties of the
printer object in Access 2002; however, paper height and paper width just
are not available that way so you have to use code like we've posted; it'll
work fine in A2002 (and 2003 for that matter.)

2.) Using the run time isn't a problem it just hides the fact that report is
open in design. The challenge or problem would occur if you db is converted
to an mde database; wherein you can't get to design mode period.
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

as
 
Back
Top