VB Code to Delete Record ?

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
 
K

Ken Snell

Not sure what may be going wrong, but I see a typo in your code. Change the
comma after vbYesNo to a ).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top