HandsOn Understanding the Data Type of a Variable

1. If the Visual Basic window is not open, press Alt+F11 to open it. Next, choose Insert | Module to add a new module.

2. Enter the code of the procedure MyNumber in the new module's Code window.

3. To run the procedure, click any line between the Sub and End Sub keywords and press F5 or choose Run | Run Sub/UserForm.

Sub MyNumberO

Dim intNum As Integer intNum = 23.11 MsgBox intNum End Sub

When you run the above procedure, Visual Basic displays the contents of the variable intNum as 23, and not 23.11, because the intNum variable was declared as an Integer data type.

Introduction to Access 2003 VBA Programming

0 0

Post a comment