Hi,
one way is to create a form that opens in hidden mode at startup.
When access closes, it closes forms in the reverse order that they were
opened.
The hidden form opened at startup will be the last form closed.
On the hidden form's unload event, put the code that needs to be run when
access closes.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia