?
Solved

access form - next record question

Posted on 2011-04-19
7
Medium Priority
?
286 Views
Last Modified: 2012-05-11


How can I modify this code to NOT add a new record if I am at the end of the file?

DoCmd.GoToRecord , , acNext
0
Comment
Question by:geedub1961
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35425751
you can use

DoCmd.GoToRecord , , acPrevious

or

DoCmd.GoToRecord , , acFirst
0
 
LVL 21
ID: 35425795
The way I like to handle this is to set the form's property for Allow Additions to false.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35425812
the op might be using a user define record navigation
see this similar  thread

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_20843155.html#a10062324
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 35428608
"How can I modify this code to NOT add a new record if I am at the end of the file?"
That code does not 'add' a new record. It only puts you at the New Record position.

However ... IF, you have code in the Form Current event that sets any values in bound fields, then a new record *will be* created, possibly erroneously.  This is why it is not a good idea to set values in the Form Current event.

Are you getting erroneous records - and thus the reason for the Question?

mx
0
 
LVL 1

Author Comment

by:geedub1961
ID: 35433599
I want to do a calculation on each of the items in my data - on the last row I want to stop the process - however it keeps adding a new rows to the bottom of the dataset.



 
0
 
LVL 1

Author Comment

by:geedub1961
ID: 35433629
What I want to happen is this

Start on row1 - calculate depreciation - move to row2 same calc and repeat process until I get to the final row and then stop the process.

So far I can start on row1 and continue - but when I get to the end of the data it adds new rows to the data.

0
 
LVL 75
ID: 35435008
Post any code you have in the Form Current event.

mx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

621 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