English
en
português
pt
Home page
Projects
Product Cost Calculation
Inventory Control
Budget Calculation
Basic Baskets Kit
School evaluation
Examples
Access
Close Application by Button "X"
Hide database window
Excel
Lock Cells
Hide Toolbars
Include a command button and change its color when clicking
Cascading combo box with SQL (Db2)
Protect spreadsheet
About Us
Contact
Close Application by Button "X"
Close Access application via the "X" button or your custom button.
With this code, when you close your application using the Exit button or the "X" button, an alert message will be displayed for confirmation.
Download Example
'Paste the code below into your main form
Private Sub Form_Unload (Cancel As Integer)
If MsgBox ("Do you want to exit the application?", VbYesNo vbQuestion, "Confirmation") = vbYes Then
Application.Quit acQuitSaveAll
Else
Cancel = True 'cancels the Form's Unload event.
End If
End Sub
Private Sub Form_Close ()
DoCmd.Quit
End Sub
'Note:
'If you have an "Exit" button on your form, paste the following code in the event of this button:
Private Sub Cmd_Exit_Click ()
On Error Resume Next
DoCmd.Close
End Sub
Follow Us!
2013-2020 - MaxVba - Automating manual work for companies in
Excel and Access
Share by: