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

Is there a 'break' or 'continue' in 'Do Unitl'... 'Loop'?

If some condition is met, I would like to move to the next record. I
tried 'Exit Do', which exits, this is not what i want; i tried 'break'
or 'continue loop', none of them works. so, now i used a label with
GoTo clause.
I am just wondering what is the correct syntax?
Thanks, ming

Nov 13 '05 #1
3 8772
hard to tell much about what you're doing without an example. Is this
inside a recordset or something?

Just put your MoveNext or GoToRecord inside an if statement or case
clause.

If TestCondition=True then
rs.MoveNext
End If

Nov 13 '05 #2
swingingming wrote:
If some condition is met, I would like to move to the next record. I
tried 'Exit Do', which exits, this is not what i want; i tried 'break'
or 'continue loop', none of them works. so, now i used a label with
GoTo clause.
I am just wondering what is the correct syntax?
Thanks, ming


The exit do is the correct syntax. Or you can have the same or a
different condition itself in the do while statement.

For example, the following is building a string, strRoute (for a list of
hexes along a straight line in a hexagonal overlay of a map):

Do While intCount <= Abs(dy)

lngY = lngY + Sgn(dy)

lngx = lngx + Sgn(dy)

strRoute = strRoute & "," & lngY & "-" & lngx & "," & lngY
& "-" & lngx - Sgn(dy)

intCount = intCount + 1

If intCount > Abs(dy) Then Exit Do

lngY = lngY + Sgn(dy)

strRoute = strRoute & "," & lngY & "-" & lngx

intCount = intCount + 1

Loop

The exit do takes it to the line immediately following the loop line.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #3
Sounds to me like you're just asking how to use blocks in a standard
recordset loop. So exit do would kick you out of, not move you to, the
next record to keep checking. It's just this:

With rst
Do Until .EOF
If SomeConditionIsMet = True Then
'do some things
'otherwise
'skip this entire
'code block
End If
.MoveNext
Loop
End With

swingingming wrote:
If some condition is met, I would like to move to the next record. I
tried 'Exit Do', which exits, this is not what i want; i tried 'break'
or 'continue loop', none of them works. so, now i used a label with
GoTo clause.
I am just wondering what is the correct syntax?
Thanks, ming


Nov 13 '05 #4

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

Similar topics

5
by: Ann | last post by:
I have trouble sometimes figuring out where break and continue go to. Is there some easy way to figure it out, or a tool? TIA Ann
3
by: Jianli Shen | last post by:
const DInst *stopAtDst = 0; while (dinst->hasPending()) { if (stopAtDst == dinst->getFirstPending()) break; ///////break? break? break? is this break outof the whole while loop and...
1
by: mhk | last post by:
Hi, i have a nested loop in Javascript and i have a break statement in inner loop. As break statement takes control come out of inner loop. I want to come out of both loops if break statement...
3
by: deko | last post by:
I have a logging routine that's supposed to silently log errors caught by error handler code on certain functions. The problem is sometimes stuff happens and the error handler can get caught in a...
14
by: serrand | last post by:
Could someone tell me a beautiful way to exit from a switch and a loop in one statement ... without using a goto... and if possible without using an auxiliary variable as i did... int res;...
12
by: Gregory Petrosyan | last post by:
Hello! It's 1:56 o'clock in St.-Petersburg now, and I am still coding... maybe that's why I encountered stupid problem: I need to remove zeros from the begining of list, but I can't :-(. I use ...
6
by: Stone | last post by:
I am looking for a code that gives the following output.It will help understand the break and continue statements. 0 0 1 0 2 4 0 3 6 9 0 4 8 12 16 0 5 10 15 20 25 0 6 12 18 24 30 36
1
by: Matt Chisholm | last post by:
Hi. I was wondering if there had ever been an official decision on the idea of adding labeled break and continue functionality to Python. I've found a few places where the idea has come up, in...
2
by: lyle777 | last post by:
I need help with using continue in my loop. they say that when using continue in the loop that is nested, depending on the condition of the continue statement, execution should jump to the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.