S
Song Su
How to do that? Thanks.
ErezM via AccessMonster.com said:hi
you need to have a form open.
then use that form's UnLoad event to check if you want the application
closed
or not, if you cancel the unload event, the form cannot close and access
will
have to stay open.
like
Private Sub Form_Unload(Cancel As Integer)
If [put your test here] Then Cancel = 1 (any value other than 0 will
cancel
the unloading of the form and therefore the closing of access)
End Sub
good luck
Erez.
Song said:How to do that? Thanks.
ErezM via AccessMonster.com said:hello again
inside a global module, create a
"Dim ExitOK As Boolean"
when the main form opens set this variable to false
"ExitOK=False"
in the Quit button you have, add this line
"ExitOK=True"
then, in the unload event check
If Not ExitOK Then Cancel=1
because only the quit button sets this variable to true, any other attempt
to
close the form will fail.
Good luck
Erez
if it's important that no form will close (all open forms will stay open),
use this technique on every form seperately (but with a different
variable)
Song said:I need more guidance.
I want people only quit the application from my main form which as a quit
button. I don't want people to click Access close button while other
forms/reports open.
Do I put unload event on all the forms or just my main form? What's the
'test' should be?
Thanks.
[quoted text clipped - 14 lines]hi
you need to have a form open.How to do that? Thanks.