killingking
MIS
how we write command to exit form with Button "Cancel"
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
Dim intResponse As Integer
Dim strPrompt As String
strPrompt = "Are you sure you want to Quit the Database?"
intResponse = MsgBox(strPrompt, vbQuestion + vbYesNo, "MyDBName")
If intResponse = vbYes Then
DoCmd.Quit
Else
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End If
End Sub
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
If MsgBox("Are you sure you want to Quit the Database?", vbQuestion + vbYesNo, "MyDBName") = vbYes then
DoCmd.Quit
Else
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End If
End Sub
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
If MsgBox("Are you sure you want to Close the form?", vbQuestion + vbYesNo, "MyDBName") = vbYes then
[purple][b]DoCmd.Close acForm, "MyFormName"
[/b][/purple] Else
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End If
End Sub
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
If MsgBox("Are you sure you want to Close the form?", vbQuestion + vbYesNo, "MyDBName") = vbYes then
[purple][b]Me.Hide[/b][/purple]
Else
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End If
End Sub
Unload Me