Close Pop up Report

  • Thread starter Thread starter alex
  • Start date Start date
A

alex

Hello all,

using Access '03...

It appears that the On Deactivate event does not fire on a pop up
report.

Does anyone have a way to close the report if it loses focus?

alex
 
Can u click on the Access Program Group in the toolbar and see the list of
open objects? Right click then select close.
 
Can u click on the Access Program Group in the toolbar and see the list of
open objects?  Right click then select close.









- Show quoted text -

Hey Maarkr,

I was hoping to do this programatically, i.e., w/ VBA. I should have
been more specific.
 
It seems not. I had not known that. From your brief description I'm not
sure where you would put this code, but it will close the report. Perhaps
it could be in the Activate event of a form, so when you click on the form
the report will close.

Dim strRpt as String
strRpt = "YourReportName"

If CurrentProject.AllReports(strRpt).IsLoaded Then
DoCmd.Close acReport, strRpt
End If

It may not be necessary to check whether the report is loaded. I'm not sure
why I do it that way, to tell the truth, but I think it is because at some
time I ran into error messages by trying to close a form that is not open.

You should be able to keep the report on top, forcing the user to close it
before going on, by setting its Pop-up and Modal properties to Yes.

If the Pop-up property is No you can close the report in its Deactivate
event, which fires when the report loses focus:

DoCmd.Close acReport, "YourReportName"

There may be some other options, depending on exactly what you are trying to
do.

Can u click on the Access Program Group in the toolbar and see the list of
open objects? Right click then select close.









- Show quoted text -

Hey Maarkr,

I was hoping to do this programatically, i.e., w/ VBA. I should have
been more specific.
 
It seems not.  I had not known that.  From your brief description I'mnot
sure where you would put this code, but it will close the report.  Perhaps
it could be in the Activate event of a form, so when you click on the form
the report will close.

Dim strRpt as String
strRpt = "YourReportName"

  If CurrentProject.AllReports(strRpt).IsLoaded Then
    DoCmd.Close acReport, strRpt
  End If

It may not be necessary to check whether the report is loaded.  I'm notsure
why I do it that way, to tell the truth, but I think it is because at some
time I ran into error messages by trying to close a form that is not open..

You should be able to keep the report on top, forcing the user to close it
before going on, by setting its Pop-up and Modal properties to Yes.

If the Pop-up property is No you can close the report in its Deactivate
event, which fires when the report loses focus:

DoCmd.Close acReport, "YourReportName"

There may be some other options, depending on exactly what you are tryingto
do.






Hey Maarkr,

I was hoping to do this programatically, i.e., w/ VBA.  I should have
been more specific.- Hide quoted text -

- Show quoted text -

Thanks Bruce,
I used the Modal option and it works great!
alex
 
Back
Top