Delete error message problem

C

carlee

Hi there,

i have a delete button on my form with the following code:

docmd.runcommand.acCmdDeleteRecord

When i run the code click delete, i get a message asking
if i am sure i want to delete. If i click yes all is
good. If i click no, i get an error stating " the run
command action was cancelled" How can I prevent this from
occuring.

I want to be able to cancel the delete if i don't want to
delete the record.

Regards,
Carlee
 
W

Wayne Gillespie

docmd.setwarnings false

Dont forget to turn the warnings back on after the delete, or you will no longer
receive system messages anywhere in the app.

DoCmd.SetWarnings False
DoCmd.RunCommand.acCmdDeleteRecord
DoCmd.SetWarnings True


Wayne Gillespie
Gosford NSW Australia
 

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