Here is a demo file containing the “On Close” script. The script is self contained and can be pasted into any FileMaker database.
How to stop the user from accidentally closing the last window in a FileMaker database
Add a script called “On Close”
In the Script, prompt them when they try to close the last window.
Add the Script “On Close” to the File Options
Under the File Menu select “File Options”
When closing this file – Perform Script “On Close”
Attach the “On Close” script when closing the file.
Now try and close the last window
The user will see the dialog box asking them if they really want to close the last window. If they click ‘Cancel’, the script halts the action of closing the window. You could swap the order of the buttons and have Cancel be the default.