runtime error 2105

Posted on 2007-07-26
Last Modified: 2008-01-09
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 Sub

    Resume Exit_cmd_Clear_Click
End Sub
Private Sub cmd_Close_Click()
On Error GoTo Err_cmd_Close_Click


    Exit Sub

    Resume Exit_cmd_Close_Click
End Sub

Private Sub submit_Click()
DoCmd.GoToRecord , , acNewRec
Exit Sub
Question by:suddzy1981
    LVL 19

    Expert Comment

    LVL 84

    Accepted Solution

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now