By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,903 Members | 2,075 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,903 IT Pros & Developers. It's quick & easy.

Button adds instead of deletes a record!

P: n/a
When I add a button and choose in the wizzard for Delete Record
operation, it does not work, instead it ADD's a record? How come?

This is the VB contents of the button:

Private Sub CmdDelete_Click()
On Error GoTo Err_CmdDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_CmdDelete_Click:
Exit Sub

Err_CmdDelete_Click:
MsgBox Err.Description
Resume Exit_CmdDelete_Click

End Sub
Bart
Acc 2003

Oct 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

AA Arens wrote:
When I add a button and choose in the wizzard for Delete Record
operation, it does not work, instead it ADD's a record? How come?

This is the VB contents of the button:

Private Sub CmdDelete_Click()
On Error GoTo Err_CmdDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_CmdDelete_Click:
Exit Sub

Err_CmdDelete_Click:
MsgBox Err.Description
Resume Exit_CmdDelete_Click

End Sub
Bart
Acc 2003
Very strange! I have just copied and pasted the code into a newly
created button and Hey Presto it deletes. Can only suggest you try the
same thing, i.e. create a new button and copy and paste the code into
it.

Oct 25 '06 #2

P: n/a
Still no result. I even tried to copy grom another databse, but the VB
text is the same. I also tried to open the databse from another PC,
same problem.
I also have choosen Menu Tools Compact and Repair Database.

Is there another way to delete a record from a form, so I can check
whether the delete record is blocked at all or not.

There are no problems in other (sub-)forms of the same database.

Bart
Tanis wrote:
AA Arens wrote:
When I add a button and choose in the wizzard for Delete Record
operation, it does not work, instead it ADD's a record? How come?

This is the VB contents of the button:

Private Sub CmdDelete_Click()
On Error GoTo Err_CmdDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_CmdDelete_Click:
Exit Sub

Err_CmdDelete_Click:
MsgBox Err.Description
Resume Exit_CmdDelete_Click

End Sub
Bart
Acc 2003

Very strange! I have just copied and pasted the code into a newly
created button and Hey Presto it deletes. Can only suggest you try the
same thing, i.e. create a new button and copy and paste the code into
it.
Oct 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.