Finding Last Row in a Table

D

Dan B

Hi;

I have a form named "FrmBeans" and a table
named "TblBeans". The table and form are "hooked up",
everythings working well, BUT if I wanted to
automatically force the data on the form to the last
record in the table, how would the code look? Is there
something like a Forms!Beans.Findlast? :)

Thanks,
Dan
 
J

John Vinson

Hi;

I have a form named "FrmBeans" and a table
named "TblBeans". The table and form are "hooked up",
everythings working well, BUT if I wanted to
automatically force the data on the form to the last
record in the table, how would the code look? Is there
something like a Forms!Beans.Findlast? :)

Thanks,
Dan

There is no "last record" or "first record" in a table, any more than
there's a "last marble" in a bag full of marbles. A table HAS NO
ORDER.

If you have a Query sorting the data in a particular order (say, by a
datestamp or sequential field) you can use the VBA command

DoCmd.GoToRecord acLastRecord

to navigate to the last record in that query's sort order. Just note
that if you don't specify a sort order (i.e. base the form on a Table)
that this record will be essentially unpredicatable.
 

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