Using the DoWhile Loop

The Do.. .While loop lets you repeat an action as long as a condition is true. This loop has the following syntax:

Do While condition statementl statement2 statementN


When Visual Basic encounters this loop, it first checks the truth value of the condition. If the condition is false, the statements inside the loop are not executed, and Visual Basic will continue to execute the program with the first statement after the Loop keyword or will exit the program if there are no more statements to execute. If the condition is true, the statements inside the loop are run one by one until the Loop statement is encountered. The Loop statement tells Visual Basic to repeat the entire process again as long as the testing of the condition in the Do.. .While statement is true.

Let's see how you can put the Do.. .While loop to good use in Microsoft Access. Curious to find out how to continuously display an input box until the user enters the correct password? Here's the hands-on that demonstrates this.

Part I

0 0

Post a comment