How do I find the ID of the Last Record of a Table?

B

BobC

I have a table in which the ID is NOT 'autonumbered'(no repetitions) and
I want to find out what the last ID used was so I can increment it in
order to add other records. By 'last record', I am referring to the
record that shows up last in datasheet view.
 
J

Jeff Boyce

Bob

"last in datasheet view" is meaningless! If you sort that datasheet
according to one field, one record shows up "last". If you reverse that
sort (sort Descending), a different record shows "last". If you use a
different field, yet another could show up "last".

You'll need to define/decide what sorting criterion/criteria you want
applied.

Access does find a "Last", but that's whatever (internal, hidden, non-human)
order Access decides to use -- humans rarely get what they're after if they
use the Access "Last"...

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
J

Jeff Boyce

(NOTE: Steve's response provides a method if the field is numeric, AND if
you are after the largest value)

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
B

BobC

Thank You Steve!
I know did not do a good job with describing 'last', but what you gave
me works great!
Bob
 
B

BobC

Jeff,
I know did not do a good job with describing 'last', but in any case,
Steve's concept works great!
Thanks for your efforts!
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top