Finding the last record

Rats

Registered User.
Local time
Tomorrow, 05:37
Joined
Jan 11, 2005
Messages
151
Hopefully this is a simple one. I am running an append query to update my database. I am then requerying it to display the record. On requerying it jumps to the first record in the database. I need it to go to the last record.
Can anyone suggest the code to just simply select the last record please?
 
Found the answer on Microsoft Help. Recordset.movelast achieves the result.
 
RunCommand acCmdRecordsGoToLast

However note that the concepts of first and last have no real intrinsic meaning in a database except through ordering. When recorded are appended to a table they don't always go to the end. The records need to be ordered by some means such as a key or date.
 
The only way you can ensure that you get the last record entered is either, as mentioned by Galaxiom (having a specific sort order on a date/time stamp for example) or by using the DLast function. DLast can pull the ID of the last record entered and then you could do a find on that.
 

Users who are viewing this thread

Back
Top Bottom