Application.SetOption "Behavior Entering Field", 0 to prevent Error 2046

Rx_

Nothing In Moderation
Local time
Today, 07:25
Joined
Oct 22, 2009
Messages
2,803
Can anyone tell me about this in menu setting or in code and its effect on forms?

Application "Behavior Entering Field", 0 was reccomended on a different web site to prevent a random Error 2046
A couple of web sites seemed to indicate the Behavior fixed this for copy/paste, deleterecord and other problems.

This error seems to happen when deleting the last record.
It is a random event. We can do the same thing many times and have it work or not work.
the BOF and EOF are both false by last record - last record for a customer in the form.

Note: added the extra code just to trap and correct the error.
When it does not want to delete, nothing seems to work.
Tried DoCmd.RunCommand acCmdSaveRecord just to resave the record before deleting it.
Code:
  If Me.Dirty Then Me.Dirty = False
     DoCmd.RunCommand acCmdDeleteRecord       
 ' err.number 2046  The command or action 'DeleteRecord' isn't available now.
                     ' Last Record
                            If Err.Number = 2046 Then
                                Err.Clear
                                Me.Recordset.Update
                                Me.Refresh ' No effect
                                On Error GoTo Err_cmdDeleteRecord_Click
                                DoCmd.RunCommand acCmdDeleteRecord
                            End If
 

Users who are viewing this thread

Back
Top Bottom