473,769 Members | 6,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How walk recset in DAO, do AddNew & return to CurRec B4 AddNew?

MLH
Here's a snippet from A97 HELP on AddNew...

The record that was current before you used AddNew remains current. If
you want to make the new record current, you can set the Bookmark
property to the bookmark identified by the LastModified property
setting.

My own experience is indicating that the newly added record becomes
current during the AddNew processes and REMAINS current after .Update
method runs. This seems true even though the newly added record does
not meet the criteria required in the recordset I'm walking through.

I put a DoEvents stmt after the .Update hoping things would work out.
Is there something else I should be doing after the .Update method
actually writes the AddNew'd record to ensure that I return to the
record that was current before invoking AddNew?
Mar 25 '06 #1
8 2351
MLH <CR**@NorthStat e.net> wrote:
<snip>
: My own experience is indicating that the newly added record becomes
: current during the AddNew processes and REMAINS current after .Update
: method runs. <snip>

: Is there something else I should be doing after the .Update method
: actually writes the AddNew'd record to ensure that I return to the
: record that was current before invoking AddNew?

Perhaps if you modify the help instruction

"you can set the Bookmark property to the bookmark identified
by the LastModified property setting."

setting it instead to

"the record that was current before invoking AddNew." ?

--thelma

Mar 25 '06 #2
MLH wrote:
Here's a snippet from A97 HELP on AddNew...

The record that was current before you used AddNew remains current. If
you want to make the new record current, you can set the Bookmark
property to the bookmark identified by the LastModified property
setting.

My own experience is indicating that the newly added record becomes
current during the AddNew processes and REMAINS current after .Update
method runs. This seems true even though the newly added record does
not meet the criteria required in the recordset I'm walking through.

I put a DoEvents stmt after the .Update hoping things would work out.
Is there something else I should be doing after the .Update method
actually writes the AddNew'd record to ensure that I return to the
record that was current before invoking AddNew?


How are you adding the record? Via a
Set rst = Me.Recordsetclo ne?
If so, you can enter
rst.Bookmark = Me.Bookmark

If not, capture the ID, and after the update do a FindFirst
Mar 25 '06 #3
rkc
MLH wrote:
My own experience is indicating that the newly added record becomes
current during the AddNew processes and REMAINS current after .Update
method runs. This seems true even though the newly added record does
not meet the criteria required in the recordset I'm walking through.


A DAO.Recordset remains on the record before the Insert.
An ADODB.Recordset makes the newly inserted record current.

Are you confused as to which you are actually using?
Mar 25 '06 #4
MLH
Oops. Oops. Oops. My bad.

Had an extra .MoveNext in there that was unaccounted
for. More bad programming on my part. Sorry about that.
After taking it out and organizing my code more legibly,
I found that the A97 HELP stmt was correct. The rec that
was current before DOES remain current. So sorry.

Something I did not realize caused me further confusion.
I did not understand that using AddNew in a DAO procedure
would increase the number of records in your recordset as
well as appending a record to the underlying table. Basically,
I was walking the recordset looking for records whose [Field1]
value was "x". When I found one, I was appending an identical
record to the underlying table, but making the [Field1] value "y".
This not only added a record to the underlying table, it added
one dynamically to the recordset. Since I was looping to EOF -
I never got there and had to CTRL-ALT-DEL and end the
process. I ended up having to do away with the Do Until - Loop
and go with a For i=1 to .RecordCount approach. What would
some of you recommend in that situation?
Mar 26 '06 #5
rkc
MLH wrote:
What would some of you recommend in that situation?


One of me would recommend an Append query.
Mar 26 '06 #6
Which of you casts his pearls before swine?

Mar 26 '06 #7
rkc
Lyle Fairfield wrote:
Which of you casts his pearls before swine?


The liberal me.
Mar 26 '06 #8
MLH
Snicker.
One of me would recommend an Append query.


Mar 28 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2605
by: rbt | last post by:
I'm trying to write very small, modular code as functions to break up a big monolithic script that does a file system search for particular strings. The script works well, but it's not easy to maintain or add features to. I'd like to have a function that builds a list of files with os.walk() and then have other functions accept that list as a parameter and modify it as needed. For example, if the user has specified that certain files...
9
8091
by: Jan van Veldhuizen | last post by:
I have an application which is running fine with MS SqlServer, but it should be working with Oracle as weel. At a lot of places we rely upon the ADO Recordset to return incremented identity columns. Oralce however returns null or zero. How can this be fixed easily? Dim mConn As New ADODB.Connection Dim rs As New ADODB.Recordset
2
1793
by: MLH | last post by:
Take a look at the code that follows. Line 110 is the beginning of Do-Loop. Regarding line #220, I find that I'm getting Error #3021 (No Current Record) during execution of line #230. It puzzles me as to Why? I thought if I was on last valid record of RecSet when line #220 executes, I would be sent to process lines after line #400. Am I wrong about that? ==> BEGIN CODE SNIPPET <=== 110 Do Until RecSet.EOF StartAnew:
5
1616
by: Mika M | last post by:
Hello! I have Windows Forms application form containing TextBoxes, six ComboBoxes, and DataGrid for details. I have created DataSet with needed tables, and created relations between tables, and bound controls to datatables. Everything is working almost fine including saving data, but when I press 'New' - button ... thisCurrencyManager.EndCurrentEdit()
6
5920
by: Bruce | last post by:
Hi all, I have a question about traversing file systems, and could use some help. Because of directories with many files in them, os.walk appears to be rather slow. I`m thinking there is a potential for speed-up since I don`t need os.walk to report filenames of all the files in every directory it visits. Is there some clever way to use os.walk or another tool that would provide functionality like os.walk except for the listing of the...
9
2876
by: silverburgh.meryl | last post by:
i am trying to use python to walk thru each subdirectory from a top directory. Here is my script: savedPagesDirectory = "/home/meryl/saved_pages/data" dir=open(savedPagesDirectory, 'r') for file in dir: if (isdir(file)): # get the full path of the file
0
1283
by: jobsearch.india02 | last post by:
Dear Job Seekers, Greetings from walkincareers.com - The Ultimate Walk in jobs Portal. For the Walk-In drives across India kindly log on to the site : ********************************************************************** To get the details about all IT openings click the link www.walkincareers.com/itwalkin.php?&id=IT
4
2190
by: mayen001 | last post by:
Hi First time i am posting a question so here goes... I have created a bit of VBA for pupils where the aim is: input line of text from file;parse the input line and extract values; using the AddNew, populate the respetive fields in the table. General outline is: Set cncurrent = CurrentProject.Connection Set rsDiag = New ADODB.Recordset 'Open the database table strsql = "Select * from tblEquipment" rsDiag.Open strsql, cncurrent,...
0
2039
by: Jeff McNeil | last post by:
Your args are fine, that's just the way os.path.walk works. If you just need the absolute pathname of a directory when given a relative path, you can always use os.path.abspath, too. A couple more examples that may help, using os.walk: .... for j in i + i: .... print os.path.join(i, j) .... /var/log/apache2
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.