Solved

Run command to close report after printing

Posted on 2014-02-07
2
858 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now