As Paul mentions, I typically will have a hidden form that is open and in its UNLOAD event I will put whatever I want, including code that will ask the user if they really wanted to close the database and setting Cancel = True if they did not, thereby keeping the database open if the close X at the top of the screen was used.