[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 586
  • Last Modified:

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
0
suddzy1981
Asked:
suddzy1981
1 Solution
 
weellioCommented:
0
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now