PDF File

J

Jim Pockmire

...looking for some code for a toolbar button that, when pressed, would print
an open report to a PDF file - essentially bypassing the change printer
widow printer and going directly to "Save as".

Is this possible and how complicated? (prdDevNames and prdDevMode are
difficult to grasp).
 
A

Albert D. Kallal

It would have helped if you mentioned what pdf system you are using
(often, many of then don't allow you set the output name etc).

however, Stephan has a solution in which you don't even have to install a
pdf maker, nor even change the printer...

Far easier then trying to mess with printers etc.

You can find his soltion here:

http://www.lebans.com/reporttopdf.htm
 
G

Guest

An alternative to my previous post would be, and I quote:

"You don't mention what version\of ms-access.

In access 2002 and later, there is a built in printer object, and it lets
you switch the printer with ease.

You can use:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

So, to save/switch, you can use:

dim strDefaultPrinter as string

' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

' switch to printer of your choice:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

do whatever....print reports

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)

If you are using a earlier versions, then you can use my lightweight printer
switch code here:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

So, I do often build a form that displays a list of installed printers, and
allow the user to select a printer. The above code example has such a form,
but that old example is REALLY only of use for pre-a2002 applications.

So, for special forms, or things like invoice printer, I sill do NOT save
which printer with the report (you *can* save the printer in ms-access, but
the feature is not much use for users since if they install, or purchase a
new printer..then the name changes..and your application will complain). So,
while we do switch printers in code..we STILL avoid saving the particular
printer to a given report. So, we always still set reports to use the
default printer.

Since the margins, and portrait/landscape are saved with the report, then
generally, just switching printers should do the trick if we kept the
margins fairly large in the reports.

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.members.shaw.ca/AlbertKallal "

Hope this helps

Daniel P.
 
J

Jim Pockmire

...thank you

Daniel said:
An alternative to my previous post would be, and I quote:

"You don't mention what version\of ms-access.

In access 2002 and later, there is a built in printer object, and it lets
you switch the printer with ease.

You can use:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

So, to save/switch, you can use:

dim strDefaultPrinter as string

' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

' switch to printer of your choice:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

do whatever....print reports

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)

If you are using a earlier versions, then you can use my lightweight
printer
switch code here:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

So, I do often build a form that displays a list of installed printers,
and
allow the user to select a printer. The above code example has such a
form,
but that old example is REALLY only of use for pre-a2002 applications.

So, for special forms, or things like invoice printer, I sill do NOT save
which printer with the report (you *can* save the printer in ms-access,
but
the feature is not much use for users since if they install, or purchase a
new printer..then the name changes..and your application will complain).
So,
while we do switch printers in code..we STILL avoid saving the particular
printer to a given report. So, we always still set reports to use the
default printer.

Since the margins, and portrait/landscape are saved with the report, then
generally, just switching printers should do the trick if we kept the
margins fairly large in the reports.

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.members.shaw.ca/AlbertKallal "

Hope this helps

Daniel P.
 

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