PDA

View Full Version : Solved: Application Close Event



MWE
09-30-2009, 08:02 PM
I am exploring work arounds for a Desk Top Search tool that can not look inside Access db files. I have an Access db with one important table and wish to export it to an xls file when Access exits. Writing the macro to do that is simple. But where does it go such that it is executed "BeforeClose". Poking around the object browser and VBA Help, I have been unable to find anything equivalent to Excel's procedure Workbook_BeforeClose.

Or perhaps there is a simpler way to do this??

Thanks

SoftwareMatt
10-01-2009, 04:20 AM
You could run it on the OnClose of a form. I often have a main form that is always open with links to everything else - when this is closed the database is closed so I would put it there.

MWE
10-01-2009, 01:51 PM
You could run it on the OnClose of a form. I often have a main form that is always open with links to everything else - when this is closed the database is closed so I would put it there.thanks for the prompt and useful reply. I tried your approach and it works quite well.

geekgirlau
10-04-2009, 09:57 PM
To add to this idea, one way to handle it is to open a hidden form when your database is launched, and have your procedure attached to the OnClose event of the hidden form. Due to the fact that the user doesn't know it even exists, the only way this form will be closed is when the databae exits.