Access 2010 Opening a form to the lat record

When i open a form i want it to be at the last record

and that the user is able to move after the opening from one record to another
LVL 1
ntsabmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
I have used this in the On Open event of forms for over 10 years now:

Private Sub Form_Open(Cancel As Integer)

     DoCmd.GoToRecord , , acLast

End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
Also note that "Last" record may be different if the form is resorted.

So a surefire way might be to always include a date/time stamp field in your table.
Then create a query of the table and sort the query by this  date/time stamp field.
Then reset the sort to this each time the form is opened.

Private Sub Form_Open(Cancel As Integer)
    Me.OrderBy = "ID ASC"
    Me.OrderByOn = True
End Sub

Or:
Private Sub Form_Open(Cancel As Integer)
    Me.RecordSource = Me.RecordSource
End Sub


THTC, ...any thoughts on this?

Jeff
0
ntsabmanAuthor Commented:
Thank's
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
Jeff,

That is a good point.  Understanding what "Last" means is important. As you pointed out, depending on the sort order of the recordset, the last record can be different.

Then reset the sort to this each time the form is opened.
Since I deploy all my front ends compiled (mde/accde) then sort order will always be the same when the for opens.

To insure that the sort order does not get changed I also clear any filter when the form closes.  I find this to be more efficient that setting the sort order every time the form opens.
0
Jeffrey CoachmanMIS LiasonCommented:
Thanks,

As you know, I never like to speak in absolutes...
It is always best to know multiple techniques and points of view...

<To insure that the sort order does not get changed I also clear any filter when the form closes.  I find this to be more efficient that setting the sort order every time the form opens. >
Every day is a school day...
;-)

Besides, your post answered the question precisely as posted.

;-)

Jeff
0
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPDesigner and DeveloperCommented:
Jeff,

Every day is a school day...
It sure is ....
;-)

Boyd
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.