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