Hello all, I have this code that deletes a record from one of my forms, so I tried copying the code into another button to delete records on another form, but it's not working.
The new button name is DeleteMgr
I am not really sure how the code works.
I tried using the wizard to create a delete button, but that was preventing my form from opening.
Thanks!
The new button name is DeleteMgr
I am not really sure how the code works.
I tried using the wizard to create a delete button, but that was preventing my form from opening.
Code:
Private Sub DeleteMgr_Click()
DoCmd.SetWarnings False
If MsgBox("Delete this record on the Manager?", vbExclamation + vbYesNo, "Dialog Form") = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else 'user clicked no
MsgBox "Deletion was aborted.", vbInformation
End If
End Sub
Thanks!