Results 1 to 6 of 6
  1. #1
    Bryce is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    3

    Red face Can't go to specified record

    I have a form with a tabbed subforms. My problem is the Add button. It gives me an error message, 'Can't go to specified record'. The VBA code running is:

    DoCmd.GoToRecord , , acNewRec

    I can add a new record if I use the Navigation bar or GoTo on the Menu bar, but my code will create an error. I want to turn off the navigation bar to avoid users from seeing all records. I have a dropdown list which allows the user to only see those records permitted. How do I get my Add button to work again?

    The form is linked to a table so all fields are bound. Any help is appreciated.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is the Button on the MainForm or the SubForm?

  3. #3
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    If your trying to add your add button to the main form, you want to instead add your add button to the subform. Then your docmd.gotorecord.... will work.

  4. #4
    Bryce is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    3

    Red face Add button - Access 2010

    Thanks for the responses. Let me clarify my predicament a bit further.

    My Add button is located on the main form, which is what I want. The subform use their Navigation buttons to add records. The Add button worked before, then I filtered or locked records based on the User's setting and I set the Navigation bar to 'off', so the user would not be able to scroll through records. The user must use a combo box to open a record (which is filtered). If they want to add a new record, then of course they use the Add button. The combo box should not impact the Add button coding.

    What gets me is that I can get a blank record if I use the main form's Navigation bar's button or the Menu 'GoTo' combo box. I tried other commands with similar results (i.e., DoMenuItem and RunCommand)

    Now the Add button gives me the "Can't go the specified record" message. I'm not sure if I'm overlooking another property setting that I may need to set?

    Thanks again

  5. #5
    Bryce is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2011
    Posts
    3
    I took out some message box code, confirming the Add action, and it works now. Not sure how that created the error message before, but I'm fine with it. So I solved the problem myself. Thanks again for your responses.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The important thing is the problem is fixed! Thanks for posting back with your success.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 07-06-2013, 05:13 PM
  2. Replies: 2
    Last Post: 03-25-2011, 12:22 PM
  3. Replies: 7
    Last Post: 12-15-2010, 09:46 AM
  4. Replies: 5
    Last Post: 06-29-2010, 01:24 PM
  5. Replies: 3
    Last Post: 06-27-2009, 03:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums