473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Prevent the next button to create new record

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
8 4824
mshmyob
904 Expert 512MB
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
3,532 Expert 2GB
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
904 Expert 512MB
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
3,532 Expert 2GB
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
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
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
904 Expert 512MB
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
904 Expert 512MB
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

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

Similar topics

3
by: William Wisnieski | last post by:
Hello Everyone, Access 2000, I have a main unbound form with a bound datasheet subform . The subform is bound to a query that returns records based on criteria in the main form. The user...
6
by: Miguelito Bain | last post by:
hi everybody- i have a form with 2 fields on it that i want the user to fill out before he or she can save the record, close the record, or move to the next record, etc... here's the code i...
12
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can...
4
by: D. Shane Fowlkes | last post by:
This may be a very simple question but I'm stumped none the less. I have a form where a user provides comments. There's a Grid below this form which displays all comments in the table so far. On...
5
by: Maria Anthonsen | last post by:
I have filled a datagrid with data from a dataset. The dataset was filled with a dataadapter - and I used the wizard to create insert, update, delete commands. I would like to prevent the user...
3
by: domcatanzarite | last post by:
How would one create a button that on click advances the form to the next "non recurring record" as opposed to the next record. The field the button needs to que from has groups of duplicate...
3
by: tlyczko | last post by:
Hello, I think what I'm asking for may not be possible, but I'll try anyway. I have MainForm with 3 subforms, one SubForm requires data entry, the other two don't (optional). MainForm has...
11
by: bill | last post by:
I dynamically create buttons and associate them with an event using AddHandler. I want all the button events to fire at one time, when the page is posted, instead of when each button is clicked....
7
by: Michiel Rapati-Kekkonen | last post by:
Hi, I would like my record to be saved only when my own close button (with all it's checks) is used. I made the winodws close button disappear, but you still can close using the right mouse...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.