Declaring and Using Variables

The previous examples briefly illustrated that variables can be declared using the Dim statement. Here are some additional examples:

Dim strMessage As String Dim rsSales As Adodb.Recordset Dim intCounter As Integer Dim blnResponse As Boolean

After it is declared, a variable obtains its value (is assigned) by setting the variable equal to a value or to an expression that evaluates to a value. The expression can contain operators (such as =, >, or <), other variables, constants, key words, formulas, and so on.

Further examples illustrating variable assignments are provided at the end of this chapter.

0 0

Post a comment