By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 1,756 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Prevent the next button to create new record

P: 3
I use a "next button" to enable user to cycle the data in a form. Behind the click_button I just use runcommand. But i need to prevent this button to create new record - when it arrived at last record. Please help me.
Apr 28 '08 #1
Share this Question
Share on Google+
8 Replies


mshmyob
Expert 100+
P: 903
Try the following in the ON CLICK event of the button

Expand|Select|Wrap|Line Numbers
  1. On Error GoTo ErrorTrap
  2.     DoCmd.GoToRecord , , acNext
  3.  
  4. ErrorTrap:
  5.     Select Case Err.Number
  6.         Case Is = 2105
  7.             MsgBox "End of Records"
  8.         Case Else
  9.         MsgBox (Err.Description & vbCrLf & Err.Number & vbCrLf & Me.Name)
  10.     End Select
  11.  
cheers,

I use a "next button" to enable user to cycle the data in a form. Behind the click_button I just use runcommand. But i need to prevent this button to create new record - when it arrived at last record. Please help me.
Apr 28 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
I believe for that code to work, the form's AllowAdditions Property also has to be set to No.

Welcome to bytes!

Linq ;0)>
Apr 28 '08 #3

mshmyob
Expert 100+
P: 903
You are right Linq - I forgot to mention that. I always turn that off and have a button to let a user make chnages or add or delete just so they don't do anything by accident. That way I can have things bound without them changing things without a concerted effort on their part.

cheers,


I believe for that code to work, the form's AllowAdditions Property also has to be set to No.

Welcome to bytes!

Linq ;0)>
Apr 28 '08 #4

missinglinq
Expert 2.5K+
P: 3,532
Me, too, that's how I spotted it! I actually run all my apps full screen with pretty much everything turned off, using custom buttons to do everything.

Linq ;0)>
Apr 28 '08 #5

P: 3
I believe for that code to work, the form's AllowAdditions Property also has to be set to No.

Welcome to bytes!

Linq ;0)>
So nice of you ! Thank you..your advise is working now ! And the answer is incredible fast.....!
Apr 28 '08 #6

P: 3
Try the following in the ON CLICK event of the button

Expand|Select|Wrap|Line Numbers
  1. On Error GoTo ErrorTrap
  2.     DoCmd.GoToRecord , , acNext
  3.  
  4. ErrorTrap:
  5.     Select Case Err.Number
  6.         Case Is = 2105
  7.             MsgBox "End of Records"
  8.         Case Else
  9.         MsgBox (Err.Description & vbCrLf & Err.Number & vbCrLf & Me.Name)
  10.     End Select
  11.  
cheers,
Thanks a lot ! it's working ! The help that immediately arrive....thank a lot !
Apr 28 '08 #7

mshmyob
Expert 100+
P: 903
Well you know what they say .... "Great minds think alike".... or is that ... "Fools seldom differ".

cheers,


Me, too, that's how I spotted it! I actually run all my apps full screen with pretty much everything turned off, using custom buttons to do everything.

Linq ;0)>
Apr 28 '08 #8

mshmyob
Expert 100+
P: 903
You're welcome, glad we could help.

cheers,

Thanks a lot ! it's working ! The help that immediately arrive....thank a lot !
Apr 28 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.