Changing report printer at runtime...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I currently have 4 invoice layouts which all have to be changed whenever an
alteration is made. Each invoice prints to a different printer depending on
if the invoice is in black & white, colour, needs to be faxed or needs to be
e-mailed. I want to be able to use one layout & change the printer for the
report at runtime. I have written some code which changes the default system
printer to the one which has been setup for whatever type of invoice I want
to print but access stores the name of the default printer and just prints to
that rather than the actual system default printer. Is there any way of doing
this? Thanks in advance for any help/suggestions.
 
If you are using Access 2002 or 2003, you can set the Printer object before
you OpenReport, and the report goes to that printer. This presumes that you
have not specified a particular printer for the report at design time,
under:
File | Page Setup | Page | Default Printer

For more detail, see:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html
There is a downloadable sample database for A2002/2003, and links to article
for Access 97 and 2000.
 
If you are using Access 2002 or 2003, you can set the Printer object before
you OpenReport, and the report goes to that printer. This presumes that you
have not specified a particular printer for the report at design time,
under:
File | Page Setup | Page | Default Printer

For more detail, see:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html
There is a downloadable sample database for A2002/2003, and links to article
for Access 97 and 2000.
 
from Rainbow01 Hong Kong

first : make your custom tool bar, its contain icon to call the Access
bulit-in printing menu
second : when open your report, also to show the above tool bar for user to
choose printer

"Bertee" 來函:
 
from Rainbow01 Hong Kong

first : make your custom tool bar, its contain icon to call the Access
bulit-in printing menu
second : when open your report, also to show the above tool bar for user to
choose printer

"Bertee" 來函:
 
I am using Access 2003 & the printer is set to default printer. When I change
the system default printer to, say, WinFax Access doesn't print to that it
prints to the default printer set at the time of design.
 
I am using Access 2003 & the printer is set to default printer. When I change
the system default printer to, say, WinFax Access doesn't print to that it
prints to the default printer set at the time of design.
 
Make sure you have unchecked the boxes under:
Tools | Options | General | Name AutoCorrect
Then compact the database.
This is known to cause problems with report settings (amongst a couple of
dozen other things.)

There is a difference between hard coding the report to use a specific
printer rather than leaving it on default printer, even if the printer you
specified is the same as the default printer at design time.
 
Make sure you have unchecked the boxes under:
Tools | Options | General | Name AutoCorrect
Then compact the database.
This is known to cause problems with report settings (amongst a couple of
dozen other things.)

There is a difference between hard coding the report to use a specific
printer rather than leaving it on default printer, even if the printer you
specified is the same as the default printer at design time.
 
I have unchecked the box and compacted the database but no difference. To
clarify, I have 1 report which I would like to print on 4 various printers
depending on option taken at time of print. The report is set through File ->
Page Setup -> Page to print to the default printer. I have a parameters form
which I setup the device/driver/port for the 5 types of printers to use (1
being the default to reset the default system printer to once printing has
been completed). When the report is printed it does change the system default
printer to the one I would like to use for that type of print BUT Access
doesn't just print it to the system default printer. It knows that the
report, at runtime, was formatted to print on a specific printer despite the
fact that the page was not set to print to that specific printer at any time
during design.
 
Quick update, Access prints to the default printer at the time of starting
the database. For instance, if the default printer is Adobe PDF when the
database is opened and my code changes the system default printer to WinFax
for the report to be faxed Access still prints to Adobe PDF. Does Access
check for the default printer before a report is printed or only at the time
the database is opened?
 
In Access 2002 and 2003, the printer that will be used is defined by the
Printer object (assuming it is not saved for a specific printer.)

When you start Access, this object is initialized to the Windows default
printer. If you want Access to use a different Printer as its default,
assign it to the Printer object, from the Printers collection.

That assignment must be made before the report is opened (i.e. you cannot
make the assignment in Report_Open when you OpenReport with acViewNormal.)
 
Bertee, did you try assigning the Printer object yet?

That was what was suggested to you in the first reply.
I think that's as far as I will take this thread.
 
I will try that as soon as I work out how. Thanks for help with this.
Hopefully it will be simpler to do in the new version of Access.
 

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

Back
Top