Record Navigation - Access Form - Disable error message when navigate past last record or before record 1?

Posted on 2011-09-21
Last Modified: 2012-05-12
I've added Previous and next Record buttons to my form.
How do I prevent error message if the user hits Previous when they are on Record 1?

Question by:OnsiteSupport
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 12

Expert Comment

ID: 36578093
Do you use an Embedded Macro?
If so, you can trap the error by placing for:

Condition: [MacroError]=2105
Action: StopMacro

Error will not being displayed.

Hope this helps,
LVL 12

Expert Comment

ID: 36578101
See attached:

 Trap error
LVL 75

Accepted Solution

DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 36578203
The quick and dirty way for nav buttons is this:

 On Error Resume Next
 DoCmd.GoToRecord , , acNext
 On Error Resume Next
 DoCmd.GoToRecord , , acPrevious


Author Closing Comment

ID: 36580774
WOW!!!! That was easy! Thanks :)
LVL 75
ID: 36582815
That's what the Staples Red button says :-)

Now ... what I posted is cheating just a tad.  You should ... add some error trapping to be technically correct. But for 99% of the time, that works.

You might find this useful also:



Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question