Solved

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

Posted on 2011-09-21
5
291 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
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,
Daniel
0
 
LVL 12

Expert Comment

by:danishani
ID: 36578101
See attached:

 Trap error
0
 
LVL 75

Accepted Solution

by:
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
 Err.Clear
   
 
 On Error Resume Next
 DoCmd.GoToRecord , , acPrevious
 Err.Clear

mx
0
 

Author Closing Comment

by:OnsiteSupport
ID: 36580774
WOW!!!! That was easy! Thanks :)
0
 
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:

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

mx

mx
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

839 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