473,746 Members | 2,513 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 2350
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
2603
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
8089
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
1791
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
5918
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
2873
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
1282
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
2186
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
2036
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
9516
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...
1
9286
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9219
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
8229
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...
1
6774
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6062
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();...
0
4587
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4840
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2200
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.