Finding the last record (1 Viewer)

Rats

Registered User.
Local time
Tomorrow, 06:53
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?
 

Rats

Registered User.
Local time
Tomorrow, 06:53
Joined
Jan 11, 2005
Messages
151
Found the answer on Microsoft Help. Recordset.movelast achieves the result.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 08:53
Joined
Jan 20, 2009
Messages
12,852
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.
 

boblarson

Smeghead
Local time
Today, 15:53
Joined
Jan 12, 2001
Messages
32,059
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

Top Bottom