Solved

Run command to close report after printing

Posted on 2014-02-07
2
932 Views
Last Modified: 2014-02-08
I have a report that a user presses a button to open and preview.. I would like to close the report if the user prints the report... after it has printed.

Is this possible?
0
Comment
Question by:thandel
2 Comments
 
LVL 84
ID: 39843865
As far as I know, there is no event that occurs only when printing to a printer. There is a "Print" event in the report's model, but that occurs when the report is opened and shown on screen.

You could remove the built-in Access print methods and create your own custom toolbar that includes a Print comment, and you could then close the report after that. Be a pain, and honestly most users don't expect a document to disappear simply because it's printed.
0
 
LVL 16

Accepted Solution

by:
Sheils earned 500 total points
ID: 39844590
As a work around you may insert a message box to ask the user if they want to print the document. This will allow you to close the report programatically if they select yes. Use the following code in the reports on Open event

Private Sub Report_Open()

Dim i as Integer

i= msgbox("Do you want to print this report",vbYesNo)

if i=vbYes then

DoCmd.RunCommand acCmdPrint
docmd.Close

End If
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question