Ok, this one has been batted around for over 10 years. I searched last night and found a myriad of suggestions, plenty of work arounds, but no definitive explanation and solution to the problem.
In my (inherited, legacy) application that i have converted to access 2013, it exhibits the same unpredictable failure on DoCmd.RunCommand acCmdSaveRecord. Unfortunately, the app has lots of form_delete, before_delete_confirm, and after_delete_confirm functions that part of the overall delete function, so converting to a recordset based delete is not ideal and is not part of the question.
Currently there are both XP and 2013 clients running this app. Users are in it all day long, and it works most of the time, but occasionally, the delete fails with a 2046 error. Sometimes the users can hit delete repeatedly and get it to work.
The button calls some validation code and then executes a DoCmd.RunCommand acCmdSaveRecord.
If Response = vbNo Then
Me![Sales Order Number].SetFocus
The various responses and suggestion attach the problem from several angles.
If Me.Dirty = True Then DoCmd.RunCommand acCmdSaveRecord
And finally, one suggestion that seems like it is on the right track. And that is that the command really is not there like the error says. The code looks to try to make the command available, but unfortunately does not work for me.
' turn the echo off
' show the db window
DoCmd.SelectObject acTable, , True
' hide the db window again
Docmd.SelectObject acTable, , True
'turn the echo back on
So my question is why is the command unavailable, and how could one restore it? My currently dev platform is 2013 with custom and standard ribbons. The standard ones are open during testing.