Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Detect print preview report closed by user

Detect print preview report closed by user

Detect print preview report closed by user

Is it possible (Access 2010) for a form that opens a report in Print Preview mode, to detect that the user has subsequently closed that report?

RE: Detect print preview report closed by user

CODE -->

Option Compare Database
Public WithEvents rpt As Access.Report

Private Sub cmdOpen_Click()
  Const rptName = "rptCustomers"
  'If you open the report in dialog you will have to add a workaround
  DoCmd.OpenReport rptName, acViewPreview
  Set rpt = Reports(rptName)
  'the below line of code is needed if you do not manually put [Event Procedure]
  'in the reports OnClose event property. Easier to add it manually.
  rpt.OnClose = "[Event Procedure]"
End Sub

Private Sub rpt_Close()
  MsgBox "The Report " & rpt.Name & " is now closed."
End Sub 

RE: Detect print preview report closed by user

CODE -->

Private Sub cmdOpenDialog_Click()
  'If you plan to open dialog then you will have less flexibility or need a bigger workaround than this
  'Set the PopUp property to yes in the report at design time
  'You will have to set the OnClose property to [Event Procedure] as design time
  'You have to open the report by the format Report_YourReportName
  Set rpt = New Report_rptCustomers
  rpt.Visible = True
End Sub 

Rest of the process is the same.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close