424,294 Members | 1,898 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,294 IT Pros & Developers. It's quick & easy.

Runtime Error When Clicking Access Close Button

P: n/a
I am continuing to develop an Access 2007 application which was
originally converted from Access 2003. In Access 2003 I was able to
disable the Access Close button in the top righthand corner of the
screen. I have been unable to find any way to disable this button in
Access 2007 and subsequently I have been forced to find ways to detect
and handle the situations after the Access Close button has been
clicked.

I have been largely successful, but have encountered once situation
for which I am rapidly running out of ideas.

I have a form which contains a command button. The command button
opens a report in preview mode. If I click on the Access Close button
while the report is displayed and the form is still open, then control
is passed to the report's OnUnload event and I am able to handle the
situation. This is only true when the application is running as
an .accdb database.

However, if I rename the database to .accdr and repeat the test, as
soon as I click on the Access Close button the application displays
the message "Execution of this application has stopped due to a run-
time error.".

I have since modified the application so that the form is closed as
soon as the report is displayed. In this scenario the .accdr
application does not display the error message and successfully passes
control to the report's OnUnload event.

Unfortunately, the second scenario was only created as part of my
ongoing research into the problem. In the real world I want to leave
the underlying form open so I can perform further processing once the
report has been closed.

I guess I need to understand exactly what happens when the Access
Close button is clicked. I'm aware that all global variables are lost
- and I can handle that situation. Any input or ideas would be most
welcome - particularly a way to disable the Access Close button, which
would solve all my problems!

Thank you, Tony.

Oct 7 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.