runtime error 2105

getting error message run-time error 2105   cannot go to specified record

here is the code for the form that I have....its at the bottom on the Private Sub submit_Click()

Private Sub Form_BeforeInsert(Cancel As Integer)
Call UsersName
Me.INSERT_USER = Username
End Sub


Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
End Sub

Private Sub cmd_Clear_Click()
On Error GoTo Err_cmd_Clear_Click


    DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70

Exit_cmd_Clear_Click:
    Exit Sub

Err_cmd_Clear_Click:
    MsgBox Err.DESCRIPTION
    Resume Exit_cmd_Clear_Click
   
End Sub
Private Sub cmd_Close_Click()
On Error GoTo Err_cmd_Close_Click


    DoCmd.Close

Exit_cmd_Close_Click:
    Exit Sub

Err_cmd_Close_Click:
    MsgBox Err.DESCRIPTION
    Resume Exit_cmd_Close_Click
   
End Sub

Private Sub submit_Click()
DoCmd.GoToRecord , , acNewRec
Exit Sub
suddzy1981Asked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
If the record is dirty, then you'll get this. Save the data before the call to acNewRec:

Private Sub submit_Click()
  If Me.Dirty Then Me.Dirty=False
  DoCmd.GoToRecord , , acNewRec
Exit Sub
0
 
William ElliottSr Tech GuruCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.