Branching and Looping

 < Day Day Up > 

So far, nearly all the code that you've seen in this book has been strictly sequential. That is, execution starts at the top of each procedure, continues line-by-line through the procedure, and stops at the end of the procedure. The one exception to this rule that you've seen so far has been in error-handling code.

Error handling in VBA was covered in "Implementing Error Handling," p. 52.


VBA is capable of more complex patterns of program execution than this, though. To write flexible VBA code, you need to understand the concepts of branching and looping. Branching lets VBA make a decision and then execute one of several statements depending on that decision. Looping lets VBA execute a statement or a set of statements more than once. As you'll see in this chapter, there are several variations on each of those themes. Together, branching and looping structures are referred to as flow-of-control statements, because they determine the order in which your program's executing flows.

     < Day Day Up > 


    Automating Microsoft Access with VBA
    Automating Microsoft Access with VBA
    ISBN: 0789732440
    EAN: 2147483647
    Year: 2003
    Pages: 186

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net