MS ACCESS DATA TYPE CODE
The Variant data type is VBA's default, so the following code interprets varValue as a Variant:Īlthough the Variant data type is flexible, VBA processes these data types a little slower because it must determine the most accurate data type for the assigned value. Use it only when you're uncertain of the data's type or when you're accommodating foreign data and you're not sure of the data type's specifications.
This data type is the most flexible of the bunch because it stores very large values of almost any type (matches the Double numeric data type). The Variant data type stores numeric and non-numeric values. Or, the data type can reference an ActiveX component, or a class object created in a class module. To declare this type, use the Dim statement in the formĪn Object variable is actually a reference to an Access object, such as a form, report, or control. By default, all String variables are of this type. In contrast, the Variable String data type grows and shrinks as required to fit its stored value. The Dim for a Fixed String is of the form:ĭim variablename As String * stringlength A fixed string can handle from 1 to 65,400 characters. There are two varieties: fixed and variable. String is another very common data type it stores values or numbers, but treats them as text. The String Data Types (Fixed & Variable lengths) The data type is similar to Double, but the range is smaller. The Single data type stores precision numbers-numbers with decimal places or fractional numbers.
The LongLong data type is also an Integer data type storing only whole numbers, but the range is much larger than the traditional Integer & Long data types. The Long data type is also an Integer data type storing only whole numbers, but the range is much larger than the traditional Integer data type. Use this data type to store only whole numbers that range from –32,768 to 32,767. This is probably the most common data type in use, besides String. Possible values range from January 1, 100 to December 31, 9999. The Date data type accepts either the date or the time, or both. You don't have to store both the date and time value. The Date data type stores a specially formatted numeric value that represents both the date and time. If you attempt to assign one, VBA returns an error. This data type doesn't support negative values. The keywords True and False are predefined constants and are interchangeable with the values –1 and 0, respectively.īyte is VBA's smallest numeric data type and holds a numeric value from 0 to 255. Use the Boolean numeric data type to store logical data that contains only two values: on and off, true and false, yes and no, and so on.