Programmatically close Report after Printing?

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi. In my application I'm opening a report in PreviewMode. After the report
is opened in print preview, users right-click the report and select Print to
print the report. Is there a way to close the report after a user
right-clicks and selects print? I figured this would be a tough task to
accomplish, but if anyone has any suggestions please let me know.

Thanks!
Mike
 
the solution here is to make your own custom print function...

For all of my reports, I have a custom menu bar with email, pdf, print to
default, print to printer of choice etc....

You thus simply build a custom menu bar (or in your case a shortcut menu
bar, and specify that shortcut menu for all reports.

The code that you have the shortcut menu button call will be:

n Error Resume Next
Dim strReportName as string
strREportName = Screen.ActiveReport.Name
DoCmd.SelectObject acReport, strReportName
DoCmd.PrintOut acPrintAll
docmd.Close


The select object command is needed to fix a "focus" bug if you have a form
with a timer function.
 
Back
Top