Form close not correctly triggering duplicate key errors

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Docmd.Close is not catching duplicate key errors as it should. it simply closes the form without saving the record, with no indication that it has done so. It does, however, correctly save records when there is no duplicate key conflict error.

Direct entry into the table correctly triggers the error. It also fails to report/save on null required key errors.

If I force a save by inserting this code just before DoCmd.Close, the error is triggered and displayed correctly:

If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord

It is not a corrupted database; I just created a blank database with a single table and just enough code to generate a duplicate key error, and it does the same thing.

What am I missing? Is this another bug in Access 2002 SP3.
 
Thanks. I guess I can stop debugging now.

Workarounds? Anything other than forcing a save on Me.Dirty before closing?

I just finished rewriting all my error handling routines, adding a workaround to ignore the 3021/2465 errors being erroneously generated on record deletion. And I found that the 3200 (referential integrity delete violation) error is being pre-empted by the 3021 in some cases. So, I now have no way to trap referential integrity delete violations, either. Now this. These all came as part of the SP3 payload, I believe.

Is this the unofficial "upgrade to Office 2003 now" campaign, or can we actually expect a real fix?

At the very least, it would be nice to be able to find a KnowledgeBase article describing the problem - it could have saved me a LOT of debugging. When I placed my support call on the 3021 error, I was told that it was a known issue but no KB article had yet been released.
 
Back
Top