Nothing happens when running DoCmd.RunCommand acCmdDeleteRecord

home70

Registered User.
Local time
Today, 14:58
Joined
Jul 10, 2006
Messages
72
I am trying to get a button to delete the current record using the command:

DoCmd.RunCommand acCmdDeleteRecord

but nothing happens when it runs. I am sure the code is running because I have set a msgbox to come up after it in the click event and it comes up.

If I use the button wizard to create the button it will delete a record, but that seems to break the "lost focus" code I use for the button.

Thank you.

(Access 2010)
 
Do you have "warnings" turned off? Turn them on and see if it is throwing an error.
 
Thanks for the help Rural Guy.

I put this into the click event ahead of the delete command:

DoCmd.SetWarnings True

but it did the same thing.

Is there another (better?) way to make sure warnings are on?
 
Last edited:
Sometimes the button and the code get separated from each other. Did you happen to create the button, write the code and then rename the button? If you did that the code is still on the old control name's click event and it needs to be moved to the click event of the new name.

Also, make sure that [Event Procedure] is shown in the click event property of the properties dialog. Sometimes that can get disconnected too if you copy a control for example.
 
Thanks guys. Bob, after checking for the things you mentioned and finding that it all seemed correct, I just rebuilt the form. It seemed less frustrating even if it was a pain. I'm glad it was a simple form.

Thanks again guys.
 
Glad to hear you got it sorted. Thanks for posting back with your solution and success.
 

Users who are viewing this thread

Back
Top Bottom