?
Solved

Run command to close report after printing

Posted on 2014-02-07
2
Medium Priority
?
1,035 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85
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 2000 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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 …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

752 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