Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-09-21
5
Medium Priority
?
324 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 2000 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

Industry Leaders: 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

Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

927 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