Applecore Pages on Microsoft Access

Returning the last Record from a Table

One thing that is often asked by newcomers to Access is 'how to get the last record in a table'. There are several problems with this:

Firstly, you need to define exactly what you mean by the 'last'. Normally it means the record that was last entered.

Secondly, tables in Access have no real order - they can best be thought of as a large bucket where records are stored in any order. The fact that you have just added a record does not mean that it will necessarily be at the end when you have entered it, and even if that is the case, there is no guarantee that it will stay at the end until more records are entered.

Thirdly, there is no built-in way of determining the last record to be added. If there is an AutoNumber field in the table, you can *SOMETIMES* rely on the highest number indicating the last entered record, but this is not infallible, as an AutoNumber might become negative or even random.

The only real way of determining the last record entered into a table is to time stamp a record when it is added, as shown here.

Top

 


HOME | NEW | TABLES | QUERIES | FORMS | REPORTS | GENERAL | API | DOWNLOADS | TUTORIAL | RESOURCES
E-MAIL
Copyright & Disclaimer

 

Last modified at 06/06/2006 14:58:55