Errors on delete

  • Thread starter Thread starter Jim Shaw
  • Start date Start date
J

Jim Shaw

BlankI have a form with sub-forms. On the subform, I have a command button
which I created using the command button wizard off the form design tool
box; it sets up the two DoCmd statements to do a record delete. I've not
modified the generated code for this.

Every time I use this button to delete a record, I get an "Application
Defined....." error, but the record is deleted anyway. The error is
generated on the first DoCmd of the pair.

When I open the table in datasheet view and delete the record there, I have
no problem.

Any ideas on what might be causing this or how to proceed with a debugging
analysis of the problem?

Thanks
Jim
 
The error message is a very generic one, so there could be lots of things
trigger that message.

Try replacing both DoCmd lines in your procedure with these two:
If Me.Dirty Then Me.Undo
If Not Me.NewRecord Then RunCommand acCmdDeleteRecord

If the error still occurs, try these steps:
1. Make sure the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Explanation of why:
http://members.iinet.net.au/~allenbrowne/bug-03.html

2. Compact the database to get rid of this stuff:
Tools | Database Utilities | Compact

3. Open the Immediate window (Ctrl+G), and go to:
Tools | References
Make sure none are marked "MISSING".
More info on references:
http://members.iinet.net.au/~allenbrowne/ser-38.html

4. Still in the Immediate Window, make sure your code compiles okay:
Debug | Compile
If there are errors, fix them and repeat until no errors.

If you're still stuck, post back for further suggestions on decompiling and
rebuilding the database.
 
Thanks Allen,
Lots of good stuff in your reply. I'll check them all out.
I had tried the decompile and rebuild to fix a corrupt db, but that didn't
fix the problem.
Also had the Name AutoCorrect turned off too.
So I replaced the two DoCmd lines with a DoCmd.runsql line. That worked
just fine.
I'll try your suggestions in other areas of my code if I run into trouble
with them too.
Thanks
Jim
 
Allen;
Well, I tried all of your recommendations;;, but none of them worked.
Apparently SP3 is not well?
This is just for your information because my DoCmd.RunSQL approach is
working famously.
Thanks for your help. I learned a lot from your references.
Jim
 
Back
Top