How to debug MS Access Run-time error 2046?

298 Views Asked by At

Our office uses MS access for storing patient's data and printing results. We've been using it for almost 2 years now. Suddenly, I have come across an error "Run-time error '2046'; The command or action 'RecordsGoToNew' isn't available now.

I tried to debug it and I can't find the error.

Here's the code it leads to when clicked on debug button:

Private Sub Form_Load()
If Not Me.NewRecord Then
DoCmd.RunCommand acCmdRecordsGoToNew
End If
End Sub

Thank you so much for answering!

1

There are 1 best solutions below

0
A.J On

I don't think the problem in mentioned code the load sub structure is correct you need to follow code debug step by step to see where is the error exactly, try to simplify your code just try, to replace acCmdRecordsGoToNew with following

Private Sub Form_Load()
    DoCmd.GoToRecord , , acNewRec
End Sub