Results 1 to 4 of 4
  1. #1
    Spark is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    5

    How to display Last record first in the form

    Hey..just a quickie question: Normally when a form opens, it displays the first record in the table first. How can we make the last record added in the table to display first in the form.


    Thanks

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    In the onload event in the properties section of the form insert this code:
    Code:
    Private Sub Form_Load()
    DoCmd.GoToRecord , , acLast
    Forms!YourFormName.FieldNameToHaveCursorSetTo.SetFocus
    End Sub

  3. #3
    Spark is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    5
    I did not understand the 'FieldNameToHaveCursorSetTo' part of it..but i got it eventually...in the properties of the form, click on load, macro builder, in the list I selected Go To record and typed in the form and the field, set the Record to LAST and its good to go Thanks anyways...

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    I did not understand the 'FieldNameToHaveCursorSetTo' part of it


    What is the name of the field you want to have focus set to when you open the form? Just substitute your field name in that part of the VBA code.

    Alan

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

Similar Threads

  1. Display record on the form
    By foxtet in forum Forms
    Replies: 3
    Last Post: 06-14-2011, 04:30 AM
  2. Display record count
    By jgelpi16 in forum Reports
    Replies: 5
    Last Post: 11-30-2010, 09:02 PM
  3. Replies: 0
    Last Post: 07-31-2010, 12:09 PM
  4. How do I display the last record?
    By daddylongtoe in forum Access
    Replies: 1
    Last Post: 06-21-2010, 10:01 AM
  5. Replies: 1
    Last Post: 04-11-2010, 04: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