Use the Close event of the form:
Private Sub Form_Close()
You may need to also uncheck Windows in Taskbar (Tools | Options | View) to
prevent the Database window showing up. (From memory, this bug was fixed in
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://www.yqcomputer.com/
Reply to group, rather than allenbrowne at mvps dot org.