Code w/in form to choose printing orientation

B

bcaron

I created a form that containes 2 list boxes - one listing all of the
available printers on the computer and one listing all of the reports within
the database. Users are able to choose a printer, select as many reports as
needed, then send those reports to the chosen printer. Some reports are
landscape and remain so when printing outside of the form. When using the
form to print, however, all of the reports default to portrait. Is there any
code I can use within the form to have the reports print based on what their
printing orientation is currently?
 
A

Albert D. Kallal

bcaron said:
I created a form that containes 2 list boxes - one listing all of the
available printers on the computer and one listing all of the reports
within
the database. Users are able to choose a printer, select as many reports
as
needed, then send those reports to the chosen printer. Some reports are
landscape and remain so when printing outside of the form. When using the
form to print, however, all of the reports default to portrait. Is there
any
code I can use within the form to have the reports print based on what
their
printing orientation is currently?

the above should be occurring. Check out:

ACC2000: Lost Printer Settings When Name AutoCorrect Is Enabled

http://support.microsoft.com/default.aspx?scid=kb;en-us;240826

The issue of printing from a form should not change the original settings
used for the reports. So, really, code to switch the printer orientation
should not be needed here....

The above bug is fixed if you installed the service paces, or disable
track-name auto correct.

if you have an later version of access, then I the bug should not be
occurring...
 
B

bcaron

I am using Access 2003. I disabled "track name auto-correct info" and the
problem is still occuring.
 
A

Albert D. Kallal

bcaron said:
I am using Access 2003. I disabled "track name auto-correct info" and the
problem is still occuring.

How are users selecting the printer?

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 those reports

Switch back.

Set Application.Printer = Application.Printers(strDefaultPrinter)

I find the above approach respects the printer settings for each report.
Perhaps you throwing up a printer dialog box in which the landscape setting
is set...and thus that what becomes the default?
 

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