Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Processing while Closing a form

Status
Not open for further replies.

Maquis

Programmer
Jul 19, 2001
934
US
Ok, I have a sticky dilemma. I want to process some queries when I close a form. Unfortunately, those queries depend on data on the form. Here's what I've tried so far:

I put the docmd.openquery's in the unload event of the form, but by then the form had already unloaded and the queries didn't run properly.

I then tried to cancel the unload in the unload event, run the queries and then execute a docmd.close, but Access didn't like that too well.

My finally option and the one I'm probably going to use is to execute the queries in the click event of my exit button, but of course if the users exit the form by pushing the little "X" button in the corner instead of using my exit button, they will not run the queries. I've tried to disable the "X" button with no success. (What is the form property "Close button" used for???? It doesn't seem to work.)

Any ideas?
 
Sorry, but that caused even more problems.

I also have a sub-form on this form and the deactivate event fired when I moved onto the sub form. These queries are deleting temp data that is needed while the form is open.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top