Freedom Computers


Form_Unload - Quit Access

Form_Unload - Quit Access with a prompt This will cause you to be locked out from editing the page but it can always be accessed from the "Code" button on the main menu bar

Create the following code from the appropriate form 'unload' event then when ever the form is unloaded the question will be asked.

Private Sub Form_Unload(Cancel As Integer)
'CANCEL is an operating system variable that controls the form Unload Command
Dim R As Long
R = MsgBox("Are you sure you want to quit Access?", vbQuestion + vbYesNo, " ")
If R = vbNo Then
Cancel = True

Exit Sub
End If