Ability to Control Flow |
Flow Control is the ability to evaluate a "condition expression"; if the condition is satisfied, the program can perform a particular action. Multiple actions may be defined, with the execution of each dependent on a particular outcome of the "condition" test.
In order for
The simplest flow control in Visual Basic is done with If and Else statements. If and Else statements can be used to program statements such as:
If the price is greater than $100, then perform a function, computation or other task. Otherwise, perform a different function, computation, or task.
Using If and Else statements, we can program this in Visual Basic:
If Field("price") > $100 Then
message = "Please call manager to double-check payment."
Else
message = "Process order normally."
End If
The above example sets the variable "message" differently depending on whether or not the price field in the current database is greater than $100.
Other types of Flow Control statements are available in Visual Basic. Some "branch," like the If-Else statements discussed above, while others "loop." Follow this procedure for more details on flow control statements:
From the Script Assistant or
Click on Feature Information.
Click on VB Script Features.
Find the category Control flow.
Click on the keywords for the flow control statements about which you are curious.