Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Warning Message when closing Access

Status
Not open for further replies.

stupiet

Programmer
Aug 21, 2001
176
US
To anyone who can help,

In access when you click on the close button in the top right corner the database will immediately close.

Is there a way to make sure a warning message pops up when you click on this, or when you use File->Exit?

This is to prevent someone from accidentally closing the database so that they don't have to keep logging on again.

Thanks for the help!

Tan
 
Here is a simple way to close db with message box. Use this code in the UnLoad event of main form.
Code:
Private Sub Form_Unload(Cancel As Integer)
    If MsgBox("If you want to quit the program Click 'Yes'", vbYesNo, "Are you sure !!") = vbNo Then
        Cancel = True
    Else
        DoCmd.Quit
    End If
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Thanks to both of you!

It's doing exactly what I wanted it to do.

Tan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top