troubleshooting Question

Deleting Records on an Access Form Using DoCmd.RunCommand acCmdDeleteRecord

Avatar of John Clingeleffer
John ClingelefferFlag for Australia asked on
Microsoft Access
1 Comment1 Solution4824 ViewsLast Modified:
I use DoCmd.RunCommand acCmdDeleteRecord behind a Delete button on a form. I know I can get around any runtime errors with a resume next before the command if the delete does not go ahead but I don't like using resume next. So I have four questions.

1. If Cancel is set to True in the form's OnDelete event this generates error 3021 - No current records. Is this to be expected and can any other valid errors be expected if Cancel is set to True.

2. If user clicks No on BeforeDelConfirm this generates error 2501 - The RunCommand actoin was canceled. Is this to be expected and can any other valid errors be expected if user clicks No.

3. Are any other "normal " error codes to be expected?

4. Is there a better way to delete records?
ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Database Architect / Application Developer
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros