Learn Access 2003 VBA with The Smart Method
90
www.LearnAccessVBA.com
Lesson 5-1: Understand data
types
Up until now we haven’t informed VBA about the data type of the
variables we’re working with. No professional programmer would
dream of using variables in this way. By telling VBA that a variable has a
data type we can prevent a whole class of bugs that are caused by data
type errors. For example, if we try to calculate the sum of two string
variables this will only trigger an error if VBA knows that their data type
is string.
Before discussing how we strongly type in code let’s review the data
types that are available and discuss where they might be used.
Session5