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.
Prevent the next button to create new record
Collapse
X
-
Try the following in the ON CLICK event of the button
[code=vb]
On Error GoTo ErrorTrap
DoCmd.GoToRecor d , , acNext
ErrorTrap:
Select Case Err.Number
Case Is = 2105
MsgBox "End of Records"
Case Else
MsgBox (Err.Descriptio n & vbCrLf & Err.Number & vbCrLf & Me.Name)
End Select
[/code]
cheers,
Originally posted by tanya68I 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. -
I believe for that code to work, the form's AllowAdditions Property also has to be set to No.
Welcome to bytes!
Linq ;0)>Comment
-
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,
Originally posted by missinglinqI believe for that code to work, the form's AllowAdditions Property also has to be set to No.
Welcome to bytes!
Linq ;0)>Comment
-
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)>Comment
-
Thanks a lot ! it's working ! The help that immediately arrive....thank a lot !Originally posted by mshmyobTry the following in the ON CLICK event of the button
[code=vb]
On Error GoTo ErrorTrap
DoCmd.GoToRecor d , , acNext
ErrorTrap:
Select Case Err.Number
Case Is = 2105
MsgBox "End of Records"
Case Else
MsgBox (Err.Descriptio n & vbCrLf & Err.Number & vbCrLf & Me.Name)
End Select
[/code]
cheers,Comment
-
Well you know what they say .... "Great minds think alike".... or is that ... "Fools seldom differ".
cheers,
Originally posted by missinglinqMe, 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)>Comment
Comment