Fetching the last record in a table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

Is there any function to fetch the last record in a table?
I have a table which has data with the data type of primary key being text.
The column value has data in the following format:
"XX/abc" . XX is some string and "abc" is a running number.
When a new record is insterted into the table, I need to increment "abc" by
1.

Could someone guide me as to how to achieve this?

TIA,
cole
 
"Last record" really doesn't have any meaning in relational database theory:
records are stored wherever they fit, so assuming you mean "last record
inserted", it can exist almost anywhere in the table.

Sounds like what you really mean is "maximum record". You can use the DMax
function, or you could write a query that uses Max.

DMax is probably the easiest.

-
Doug Steele, Microsoft Access MVP

(no e-mails, please!)
 
You can add another field, with a counter so the max of that field is always
the last field added to the table, this field for information only, for your
use.
 
Back
Top