Solved

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

Posted on 2011-09-21
5
290 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 - Access MVP) 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

803 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