Finding Last Record

W

Wes

Being very new to Access I am struggling a bit, so need some assistance.
I have an ACCESS 2000 manual and keep trying to figure it out, but I
am just a bit ACCESS deprived.

I have a form that will be used for New Employees. When I OPEN the
form, (OPEN event, I think,) I need to get to the last record in my
table. I have tried

DoCmd.GoToRecord acDataTable, "SalesAssociate", acLast

but get an error saying the table is not open.

I have tried several other things, but nothing seems to work.

I know I have it wrong, but can't figure it out.

Any suggestions

Thanks

Wes
 
J

Jeff Boyce

Wes

Access tables store data rather like "buckets o' data". That is, there's no
inherent (human-perceptible) order. Thus, the "Last" record only makes
sense if YOU have imposed some sort order.

What you YOU mean by "last"?

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 pseudocode 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

J_Goddard via AccessMonster.com

Hi -

If you are using this in a form, try using DoCmd.GoToRecord ,,acLast.

This will go to the last record in whatever dataset the form is using as its
RecordSource,
e.g. tblEmployee

If you are using the form to add new data, use acNew instead of acLast.



John
 
W

Wes

Wes

Access tables store data rather like "buckets o' data". That is, there's no
inherent (human-perceptible) order. Thus, the "Last" record only makes
sense if YOU have imposed some sort order.

What you YOU mean by "last"?

Regards

Jeff Boyce
Microsoft Access MVP
I need to ADD a new employee. In the Access manual, looking at the
sequence of events, it indicates that using the OPEN event you can
determine if this is a "new" reocrd. If so, you need to move to the end
of the recordset. Otherwise you will continue to use the first record.

Unfortunately, I am at a big disadvantage. I have several years of
experience using the "big" relational databases, Oracle, Sybase, DB2,
etc., and the programming is completely different. I am trying to learn
to use ACCESS for a small business I am starting. At the moment it is
challenging, but it looks like a really cool facility that has a lot of
power.

Oh, I do have some small amount of VBA experience, but that is from the
EXCEL perspective.

Thanks for the help

Wes
 
J

Jeff Boyce

Since Access tables are buckets o' data, you do not need to go to the last
record before adding a new one.

Check Access HELP for "adding a new record".

There's even a property in forms that lets them be used ONLY for entering
new records. Again, Access keeps track of where it gets added, so you don't
have to.

Good luck!

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 pseudocode 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

John Spencer

If you want to move to the last record that the form is bound to.

DoCmd.GoToRecord acDataForm, "NameOfForm", acLast




John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

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