Connecting Tech Pros Worldwide Help | Site Map

Code not completely running

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 05:22 AM
Koontzie
Guest
 
Posts: n/a
Default Code not completely running

Hello all,

I have a form in Access XP that returns all printers intalled on the
users system. The select which printer they want to print to and click
a "Next" button. The button click event runs the code at the bottom of
this page to open a number of reports, change the printer to the one
the user specified, save and close, then print the reports. The code
does everything but save the printer, so the report prints to whatever
printer was previously saved in the report.

This code runs fine if run directly within the module, but when it's
fired from a click event in a form it doesn't.

I have repaired and decompiled, any other thoughts? Thanks in advance
for any advice you may have.

code:

Public Sub sChangePrinter(strReport As String, strDeviceName As String,
Optional strOrientation, Optional strPaperSize)

Dim rpt As Report
DoCmd.OpenReport strReport, acViewPreview
Set rpt = Reports(strReport)
rpt.Printer = Application.Printers(strDeviceName)
rpt.Printer.Orientation = strOrientation
rpt.Printer.PaperSize = strPaperSize
DoCmd.Close acReport, strReport, acSaveYes
rpt.Printer = Application.Printers(strDeviceName)
rpt.Printer.Orientation = strOrientation
rpt.Printer.PaperSize = strPaperSize
DoCmd.Close acReport, strReport, acSaveYes
DoCmd.OpenReport strReport, acViewNormal

End Sub


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.