You can detect a form being closed by its On Close event. If there is a
command button that closes the form and you need to know whetjer that or
the [X] was used, then you can add a hidden control (unbound textbox or
label) to the form's design, and change its value/caption in the first
line of code of the button's Click event; that way, your form's On Close
code can check the value/caption and determine whether the command
button has been clicked or not.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.