Report Print event? (1 Viewer)

sja13

Professional Idiot
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?
 

Ranman256

Registered User
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.
 

arnelgp

error reading drive A:
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
 

MarkK

Super Moderator
You can popup the report if you use acDialog...
Code:
DoCmd.OpenReport "Report1", acViewPreview, , , [COLOR="Blue"]acDialog[/COLOR]
...and then it will appear on top of your popup menu.
hth
Mark
 

sja13

Professional Idiot
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!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top