473,395 Members | 1,568 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.

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.TreeField & CRLF & CRLF
220 RecSet.MoveNext ' Kicked out-a-the-loop here???
230 MyVar1 = Trim$(CStr(RecSet.Cust_ID)) & RecSet.RName
....

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

Nov 12 '05 #1
2 1776
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**@NorthState.net> wrote in message
news:t9********************************@4ax.com...
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.TreeField & CRLF & CRLF
220 RecSet.MoveNext ' Kicked out-a-the-loop here???
230 MyVar1 = Trim$(CStr(RecSet.Cust_ID)) & RecSet.RName
...

380 Close #1 ' Close file.
390 ... more code ...
400 Loop
FinishTheLast:
410 WhereAmI = "FinishTheLast"
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.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx
On Sun, 21 Sep 2003 18:01:08 GMT, "Douglas J. Steele"
<dj******@canada.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
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 =...
9
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--) {...
0
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...
6
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...
3
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...
11
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...
3
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
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...
1
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...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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,...

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.