Results 1 to 7 of 7
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    Make last record in Form's RecordSource the current record

    Make last record in a Form's Sub-form RecordSource the current record when the sub-form displays. I put the following code in the OnLoad event and the "MoveLast" statement referring to the clone works but that doesn't effect the current RecordSource. If there is a option in Access to accomplish what I've asked it would seem that my Google search expression missed the mark?



    Code:
        Dim rst As Recordset
    
        Set rst = Me.RecordsetClone
        rst.MoveLast

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    what about :
    Me.Recordset.MoveLast

    (filter off)

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    While I didn't mention in my original post about my attempt to use exactly what you've suggested to begin with, the RecordSource is Filtered so maybe that's why the Me.Recordset.MoveLast failed?

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What about GoToRecord with acLast?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Join Date
    Apr 2017
    Posts
    1,679
    Quote Originally Posted by GraeagleBill View Post
    While I didn't mention in my original post about my attempt to use exactly what you've suggested to begin with, the RecordSource is Filtered so maybe that's why the Me.Recordset.MoveLast failed?
    The RecordSource is probably somehow ordered too? Set this order DESC, then the currently last record will be 1st.

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Thanks Paul, that did the trick!
    Bill

    Code:
    Private Sub Form_Load()
    Me.Filter = "SerialNo <= " & intBlkSz
    Me.FilterOn = True
    Me.FilterOnLoad = True
    
    DoCmd.GoToRecord , , acLast
    End Sub

  7. #7
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help Bill!

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

Similar Threads

  1. Replies: 1
    Last Post: 05-18-2015, 01:27 AM
  2. Replies: 3
    Last Post: 02-06-2015, 01:18 PM
  3. Current record vs VBA and make record
    By Ruegen in forum Programming
    Replies: 2
    Last Post: 03-17-2014, 11:12 AM
  4. Replies: 8
    Last Post: 10-27-2011, 02:11 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