Exit a loop when I have what I want

  • Thread starter gmazza via AccessMonster.com
  • Start date
G

gmazza via AccessMonster.com

Hi there,
I have been looking through all the examples in the forum and I cannot find
what I need.
I have a loop that looks for a certain value in a field, once it finds that
value it changes some things and I need to abort the loop, I need to get out
of the loop before it goes to the next record and does the same thing and
screws up what was changed.
Is there some way you can just get out of a loop NOW kinda thing?
Thanks!!
 
D

Douglas J. Steele

What kind of loop? Both Do and For loops have related Exit statements:

Do [{While | Until} condition]
[statements]
[Exit Do]
[statements]
Loop

For Each element In group
[statements]
[Exit For]
[statements]
Next [element]

For counter = start To end [Step step]
[statements]
[Exit For]
[statements]
Next [counter]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top