Can someone help me modify this code slightly please. When users open the database, there is a form with cmd button to trigger a delete query to replace existing data in a table. I want to modify this code so if the user selects "Yes" to delete contents, the a macro "ImportUnmatched" will run after data is deleted, and if the user selects "No" another form called "frmUnmatched" will open after they receive the message box that data was not deleted appears.
Appreciate your help
Private Sub cmdConfirm_Click()
On Error GoTo Err_cmdConfirm_Click
Dim stDocName As String
Dim intAnswer As Integer
stDocName = "qryDeleteTblUnmatched"
DoCmd.OpenQuery stDocName, acNormal, acEdit
intAnswer = MsgBox("You are about to replace your previous analysis. Are you sure you want to this?", vbQuestion + vbYesNo, "Delete Record")
If intAnswer = vbYes Then
RunCommand stDocName = acCmdConfirm
End If
Exit Sub
cmdConfirm_Click_Err:
MsgBox "Analysis was not replaced!"
Exit Sub
Exit_cmdConfirm_Click:
Exit Sub
Err_cmdConfirm_Click:
MsgBox Err.Description
Resume Exit_cmdConfirm_Click
End Sub