473,769 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exactly where is it that I get kicked out of a Do Until ... Loop while traversing records in DAO RecSet???

MLH
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:
120 WhereAmI = "StartAnew"
....

190 i = i + 1
200 WhereAmI = "Point2"
AddStuff:
210 MyVar0 = MyVar0 & RecSet.TreeFiel d & CRLF & CRLF
220 RecSet.MoveNext ' Kicked out-a-the-loop here???
230 MyVar1 = Trim$(CStr(RecS et.Cust_ID)) & RecSet.RName
....

380 Close #1 ' Close file.
390 ... more code ...
400 Loop
FinishTheLast:
410 WhereAmI = "FinishTheL ast"
420 RecSet.MoveLast
430 MyVar2 = MyVar2 & RecSet.MyField
==> END CODE SNIPPET <===

Nov 12 '05 #1
2 1792
It's not as though the code on line 110 sits in the background, waiting
until you hit EOF. It's not analogous to On Error GoTo..., if that's what
you're thinking.

Statement 110 only checks for EOF when it gets executed. In other words, the
only time that statement does anything is when the Loop statement on line
400 tells execution to return to line 110.

Every time you have a MoveNext statement, the very next statement must be a
check for EOF.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
"MLH" <CR**@NorthStat e.net> wrote in message
news:t9******** *************** *********@4ax.c om...
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:
120 WhereAmI = "StartAnew"
...

190 i = i + 1
200 WhereAmI = "Point2"
AddStuff:
210 MyVar0 = MyVar0 & RecSet.TreeFiel d & CRLF & CRLF
220 RecSet.MoveNext ' Kicked out-a-the-loop here???
230 MyVar1 = Trim$(CStr(RecS et.Cust_ID)) & RecSet.RName
...

380 Close #1 ' Close file.
390 ... more code ...
400 Loop
FinishTheLast:
410 WhereAmI = "FinishTheL ast"
420 RecSet.MoveLast
430 MyVar2 = MyVar2 & RecSet.MyField
==> END CODE SNIPPET <===

Nov 12 '05 #2
MLH
Man, you have really cleared the air for me. I was assuming
the code in line #110 operated like On Error GoTo. You had
me pegged! Thx much for the explanation.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx x
On Sun, 21 Sep 2003 18:01:08 GMT, "Douglas J. Steele"
<dj******@canad a.com> wrote:
It's not as though the code on line 110 sits in the background, waiting
until you hit EOF. It's not analogous to On Error GoTo..., if that's what
you're thinking.

Statement 110 only checks for EOF when it gets executed. In other words, the
only time that statement does anything is when the Loop statement on line
400 tells execution to return to line 110.

Every time you have a MoveNext statement, the very next statement must be a
check for EOF.


Nov 12 '05 #3

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

Similar topics

4
5835
by: .Net Sports | last post by:
I am trying to display records from a recordset after sql statement: <% sqlstr ="SELECT horsename FROM tblhorseentry WHERE trackname = '" & request.querystring("trackname") & "' and racedate = '" & request.querystring("racedate");" Set rs1 = Server.CreateObject("ADODB.Recordset") rs1.Open sqlstr,pConn,3
9
3563
by: No Such Luck | last post by:
I have a function which requires me to loop from the end of a string to the beginning on a char by char basis: int foo (char string) { unsigned int i; for(i = strlen(string); i >= 0; i--) { /* do something */
0
991
by: Mamatha | last post by:
Hi i have a code to retrieve table structures of SQL Server database. It gives all the table names in particular databse with the column names and datatypes also. But the output displays not in the exact order of what i am designing in SQL Server database,mainly coulmnnames are not in order. I want to displayed output exactly like what i was designed in SQL Server table.
6
5018
by: Dixie | last post by:
I have asked this question before, but I could not get the suggested solution work. So I will give more details this time. I have an append query that adds several hundred records to a table into a text field. Next to this text field is a separate Number (Single) field with a unique ID number for the entry. I want each number to be 1 more than the previous entry's number to keep it unique (I don't want autonumbering for this, as I...
3
2712
by: rperetz | last post by:
Hi all, I was given a task to create a houseHolding logic under a table that have millions records. first let me explain what is a house holding: let's say I have 2 records that have the same phone number, that mean that both records are under the same household, but this can get more complicated this article explain it http://www.teradata.com/t/page/115924/index.html
11
5707
by: Douglas | last post by:
Hi Im not an SQL n00b, but I'm no SQL guru... I'd like to work out the SQL code required to achieve the following goal in pseudocode: Grap a record Using info from that record, add (the width) to a running total. When the running total exceeds a certain value, stop grabbing records.
3
2031
by: tehgreatmg | last post by:
Here is my code: Dim db As DAO.Database Dim rs1 As DAO.Recordset Set db = CurrentDb() Set rs1 = db.OpenRecordset("CartUse") rs1.MoveFirst Do Until rs1.EOF
16
2059
by: metalheadstorm | last post by:
ok i think this question should go here seeming its more based around SQl code rather than the vb code. Heres my problem i have a program in vb6 with a acees backend, the table "Invoice" in the Db has about 38500 records 9 and will go up)which seems to be over the limit that a vb data grid can display. As when i view the data grid it starts out invoice_Id 84 rather than 1, but that is now fixed as i just did an Order BY ASC so thats ok ...
1
1529
by: somcool | last post by:
I am facing an error while traversing a query in MS Access Details - When I click a button, a form which has the query opens up. There are certain fields which are in the form of combo box in the query. The query comes from a table which picks values from another table. When I try traversing the query through TAB button, I get the following warning - "The value you entered isnt valid for this field. For example you might have entered a text...
0
10199
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
10035
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...
1
9981
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
9850
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
8862
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
7396
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
5436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3948
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
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.