Results 1 to 4 of 4
  1. #1
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44

    Go to the last record on subform

    Good day.



    I'm having an issue with a subform.

    I currently have the following VBA code in the subform's On Current event:
    DoCmd.RunCommand acCmdRecordsGoToLast


    No I have a problem. Whenever I want to add a new record on this subform, it tells me that I can't go to the specified record.

    Obviously, I'm not using the right code to go to my last record when I open the form. But what would I use, and where?

    Thanks.

  2. #2
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    Crisis averted.

    I placed this command in the MAIN form's On Current event, but I had to set focus first. So this is what I have:

    Me.name of subfrm.SetFocus
    DoCmd.RunCommand acCmdRecordsGoToLast

    Works great now.

  3. #3
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Or in the subform's OnLoad event: DoCmd.GoToRecord,,acLast

  4. #4
    dotcanada is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Alberta, Canada
    Posts
    44
    Apparently, my solution above didn't work. And I tried your suggestion aytee. It didn't work in the OnLoad event. But it did work in the OnCurrent event.

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

Similar Threads

  1. Replies: 4
    Last Post: 03-06-2015, 12:38 AM
  2. Replies: 7
    Last Post: 04-15-2014, 01:15 PM
  3. Replies: 8
    Last Post: 08-09-2013, 09:52 AM
  4. Replies: 6
    Last Post: 08-22-2012, 03:24 AM
  5. Replies: 6
    Last Post: 05-05-2012, 08:43 AM

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