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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

738 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