473,395 Members | 1,456 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,395 software developers and data experts.

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 2316
MLH <CR**@NorthState.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.Recordsetclone?
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
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...
9
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...
2
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...
5
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...
6
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...
9
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') ...
0
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 : ...
4
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...
0
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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...

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.