Solved

Run command to close report after printing

Posted on 2014-02-07
2
911 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

813 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

15 Experts available now in Live!

Get 1:1 Help Now