Solved

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

Posted on 2011-09-21
5
283 Views
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?

Thanks
0
Comment
Question by:OnsiteSupport
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:danishani
Comment Utility
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,
Daniel
0
 
LVL 12

Expert Comment

by:danishani
Comment Utility
See attached:

 Trap error
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
Comment Utility
The quick and dirty way for nav buttons is this:



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

mx
0
 

Author Closing Comment

by:OnsiteSupport
Comment Utility
WOW!!!! That was easy! Thanks :)
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
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:

http://www.lebans.com/recnavbuttons.htm

mx

mx
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now