Results 1 to 6 of 6
  1. #1
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476

    How to have a Form open to Last Record

    The Code in which I often use (& works) to have a Form open up to a New Record is:

    Private Sub Form_Load()
    DoCmd.GoToRecord , , acNewRec
    End Sub

    However, in one of my Forms I wish to have it open up to the Last Record, so in my above code I thought to replace 'New' with 'Last' but it's not working.

    Private Sub Form_Load()
    DoCmd.GoToRecord , , acLastRec
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Try acLast.

    As you type the code, are you seeing intellisense popup tips?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Damn, now I can't remember what Form I was working with. Thanks June, I'm going to mark this thread as solved. If I remember which Form & have a problem I'll PM you.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you left the code in place a Debug>Compile should hit on the bad line. Or do a Find search of the VBA code for the acLastRec string.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Tracyd is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    4
    hi - I'm trying to do the same, but not working ! any suggestions? - I want to display the last record on form load?

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Try:
    DoCmd.GoToRecord , , acLast
    instead of:
    DoCmd.GoToRecord , , acLastRec
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 11
    Last Post: 01-26-2012, 01:22 PM
  2. Replies: 5
    Last Post: 11-11-2011, 11:06 AM
  3. new record open form
    By tubar in forum Forms
    Replies: 5
    Last Post: 03-31-2011, 12:33 PM
  4. If record does not exist, open add new record form
    By RobertIngles in forum Programming
    Replies: 2
    Last Post: 02-01-2011, 08:47 AM
  5. Replies: 1
    Last Post: 11-30-2010, 10:05 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