Programmatically close Report after Printing?

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
 
A

Albert D. Kallal

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.
 

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