Results 1 to 5 of 5
  1. #1
    gar is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Nov 2011
    Posts
    42

    Functionality of "movelast"

    I have a VBA procedure the correct functionality of which depends upon the "<recordset>.movelast" method accessing, consistently, the record most recently added to the recordset (I.e. that new records are added to the end of the recordset and that the order of records in the recordset is fixed.). The procedure did work satisfactorily for some time but has recently failed. I recall that the relational model requires that the order of records in a table be undefined; is this the case in Access and if so what does "movelast" do?

  2. #2
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    There is no set order to table data, records are added with the PK field getting the next highest number available, there are things that can change the order of the records, eg sort on another field and save the table it will stay like that, with a different 'last record data' returned by movelast.


    The movelast moves the record pointer to the last record in the table. Commonly used to find the record count in a vba recorset.

  3. #3
    gar is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Nov 2011
    Posts
    42
    Thanks very much for your message; I'll have to find another way round.

  4. #4
    gar is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Nov 2011
    Posts
    42
    Sorry to trouble you with this but I can't find the answer anywhere; how do I mark the thread as solved?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You can mark the thread solved under Thread Tools at the top. To your question, open the recordset on an SQL statement that includes an ORDER BY clause, and your MoveLast should bring you to the desired record.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 11-14-2012, 04:47 PM
  2. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  3. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  4. Replies: 16
    Last Post: 07-22-2011, 09:23 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