VB Code to Delete Record ?

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

I want it to ask me if I am sure I want to do this and then delete the
record if answer is yes.
What is wrong with my code? Form name is BlankChecks table name is
tblchecks.

On Error GoTo Err_Command117_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
If vbYes = MsgBox("Are you sure you want to Void this Check?", vbQuestion +
_
vbYesNo, Then
DoCmd.RunCommand acDeleteRecord


Else:
End If
Exit_Command117_Click:
Exit Sub

Err_Command117_Click:
MsgBox Err.Description
Resume Exit_Command117_Click
 
Not sure what may be going wrong, but I see a typo in your code. Change the
comma after vbYesNo to a ).
 
Back
Top