Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 12-15-2017, 03:39 AM   #1
sja13
Professional Idiot
 
sja13's Avatar
 
Join Date: May 2017
Location: God's Own County
Posts: 63
Thanks: 26
Thanked 0 Times in 0 Posts
sja13 is on a distinguished road
Report Print event?

Hi guys (again!)

I have a pop-up Form which has a command button to print a Report.

When the Report is activated (in Preview mode) I need to hide the Form so the User can see the preview.

My problem is getting the Form visible again when the User “dismisses” the Report, either by printing it or closing it.

Although there is a Report Close event, there doesn’t seem to be a Report Print event in which I can put VBA code to re-display the "invoking" Form.

Can anyone point me in the right direction?

__________________
Steve
"Ask any question, even if you think it's stupid. It's still the one everyone else is wishing someone else would ask!"
sja13 is offline   Reply With Quote
Old 12-15-2017, 03:42 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,376
Thanks: 0
Thanked 746 Times in 731 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: Report Print event?

when the preview report shows, the form IS hidden. It is behind the report.
Close the report, you see the form again. Nothing more needs done.
Ranman256 is offline   Reply With Quote
Old 12-15-2017, 03:48 AM   #3
sja13
Professional Idiot
 
sja13's Avatar
 
Join Date: May 2017
Location: God's Own County
Posts: 63
Thanks: 26
Thanked 0 Times in 0 Posts
sja13 is on a distinguished road
Re: Report Print event?

No it isn't. That's the part of the problem (see attached).
Attached Images
File Type: jpg PrintPreview triggered.jpg (58.7 KB, 61 views)

__________________
Steve
"Ask any question, even if you think it's stupid. It's still the one everyone else is wishing someone else would ask!"
sja13 is offline   Reply With Quote
Old 12-15-2017, 04:21 AM   #4
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Report Print event?

after opening the report usind docmd. open report, issue:

Me. Visible=False

then on the Close Event of the report, issue:

[Forms]! yourpopupFormName. Visible=True
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
sja13 (12-15-2017)
Old 12-15-2017, 09:04 AM   #5
MarkK
Super Moderator
 
MarkK's Avatar
 
Join Date: Mar 2004
Location: Vancouver BC
Posts: 7,761
Thanks: 10
Thanked 1,290 Times in 1,227 Posts
MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all MarkK is a name known to all
You can popup the report if you use acDialog...
Code:
DoCmd.OpenReport "Report1", acViewPreview, , , acDialog
...and then it will appear on top of your popup menu.
hth
Mark
__________________
formerly known as lagbolt | Windows 10 | Access 2010 | Visual Studio 2013 | "Institutions have a vested interest in perpetuating the problems to which they are the solution." - Clay Shirky
MarkK is offline   Reply With Quote
The Following User Says Thank You to MarkK For This Useful Post:
sja13 (12-15-2017)
Old 12-15-2017, 09:38 AM   #6
sja13
Professional Idiot
 
sja13's Avatar
 
Join Date: May 2017
Location: God's Own County
Posts: 63
Thanks: 26
Thanked 0 Times in 0 Posts
sja13 is on a distinguished road
Re: Report Print event?

OK – firstly thanks to all who took the time to reply.
Special thanks to arnelgp, whose conceptual solution worked just fine.
For the sake of completeness, and in case anyone else wants the full tale, what the actually solution was in my circumstances was as follows:-
I have a number of Reports which are “massaged” by the circumstances in which they are invoked. The modification is for example adding “WHERE” clauses, and/or Sort Order clauses, some of which are picked up using OpenArgs.
So my first attempt was, in the invoking VBA, using
Code:
Public gbooStdReportRequested   As Boolean
in a standard module, then in the Report invocation routine
Code:
  gbooStdReportRequested = True
  DoCmd.OpenReport strReport, _
                   acViewPreview, _
                   , _
                   strWhere, _
                   , _
                   strOpenArgs
  gbooStdReportRequested = False
and in the Reports Close event using
Code:
If gbooStdReportRequested Then
   Forms("frmStdReports").Visible = True
 End If
Oops! – obviously, there’s a synchronisation issue, ‘cos by the time I hit the Print or Close, gbooStdReportRequested was already reset back to False by the Report invocation routine!
So I shifted the flag unsetting to the Report’s Close VBA, and suddenl Robert is your avuncular relative!
Code:
 If gbooStdReportRequested Then
'*
'** Clear the "Invoked by Std Reports" flag.
'*
   gbooStdReportRequested = False
   Forms("frmStdReports").Visible = True
 End If
N.B. As it happens, I used

Code:
   Forms("frmStdReports").Visible = True
Instead of
Code:
  Forms!frmStdReports.Visible = True
Which worked, but the original suggestion may have been just as good: I started fiddling about with the code before I relised the issue was synchronicity, and stopped fiddling when it worked!

__________________
Steve
"Ask any question, even if you think it's stupid. It's still the one everyone else is wishing someone else would ask!"
sja13 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Graphics - print event in Access report or Excel max1 Reports 4 08-29-2015 09:18 PM
Close Event to Print Report velcrowe General 1 06-30-2006 09:08 AM
Auto Print Report for only Latest Record on Add New Record Event?? Jon-G General 7 06-26-2005 06:32 PM
Report Event procedures not firing when directly print GumbyD Reports 3 08-17-2004 10:13 AM
Simple code for 'OnLoad' event to print a report nicktheblue Modules & VBA 2 10-19-2001 05:19 AM




All times are GMT -8. The time now is 10:47 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World