If you have a form open the whole time (I have a main menu open), you can put the code in the form's Close() event. If you don't have a form that does this, you can open a new form on startup and hide it. Then on exit THAT form's Close() event will be called.
Addendum: don't depend on your users closing the database in a proper manner. This may work 99% of the time, but for the 1% it doesn't...just keep this in mind.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.