O'Reilly logo

Microsoft® Access® 2010 24-Hour Trainer by Truitt L. Bradly, Geoffrey L. Griffith

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

54

Using Variables in VBA

As you've seen in the previous two lessons, variables play a critical role in VBA programming and as such, deserve a detailed explanation of the different kinds of variables and how they can be used. Although you have already used variables in many places throughout this book, it is important to discuss the different kinds of variables and what the differences mean in the VBA code. It is important to understand that where and how a variable is declared will determine how it can be used in VBA code. This lesson is devoted to discussing the kinds of variables allowed in VBA and what the differences are between them.

LESSON SETUP

This lesson is designed to provide information about using variables in VBA and the different kinds of variables it provides. You should be familiar with Access databases, creating modules, and the basics of VBA programming to complete this lesson. Otherwise, this lesson does not require any other specific knowledge of Access.

VARIABLES IN VBA

Variables in a programming language are a way of temporarily storing, retrieving, passing, and manipulating data in code. Variables in VBA are typically declared with a data type, called a Class, to denote the kind of data that will be stored in the variable, though explicitly specifying the data type is not required in VBA. When a variable is declared without a type, it is automatically given the type Variant, which can store any type of data by implicitly casting it to the data type of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required