Re: MS Access VBA Code ???
if i understand you correctly, you are trying to prevent the user from closing the form by selecting:
File>Close
from the menu bar?
thus ensuring that they close the form via your command button?
you are by definition closing the form, and your call to check that it is closed correctly is called only when the form is closing.
you would need to re-open the form within the function (if possible), or call a global function to deal with your on close, which will re-open the form.
or to disable the in-built menus and define your own for the functionality that the user needs.
im sure someone will be along to prove me wrong in a minute :bigyello:
HTH
Re: MS Access VBA Code ???
Have a look at the Close and unload events of the form. I think one of them has a cancel long value which when set to other than 1 cancels the closing of the form.
How this works if they close the db, I don't know. If you don't want them closing the form via the menu, then turn off all the menus except you own?