HandsOn Using the DoUntil Loop

1. In the Visual Basic Editor window, insert a new module and type the AskForPassword3 procedure.

Sub AskForPassword3() Dim pWord As String pWord = ""

Do Until pWord = "DADA"

pWord = InputBox("What is the Report password?")

Loop End Sub

The first line of this procedure says: Perform the following statements until the variable pWord holds the value DADA. As a result, until the correct password is supplied, Visual Basic executes the InputBox statement inside the loop. This process continues as long as the condition pWord = "DADA" evaluates to False.

Introduction to Access 2003 VBA Programming

0 0

Post a comment