VBA Internals: Scalar Variables and Pointers in Depth

May 28, 2013 in VBA

In VBA Internals: What’s in a variable, I introduced the types of variables in VBA as categorized by how they are implemented. In VBA Internals: Getting Pointers, I described the functions used to obtain pointers in VBA. Now we’ll take the next step: Putting these two ideas together to really get an inside view of variables in VBA. Memory utility functions In the examples here, I use two utility functions of my own making: HexPtr is a quick function to format a LongPtr in fixed-width hexadecimal format. Mem_ReadHex reads an arbitrary number of bytes from memory and returns them as
…read more

Microsoft Access Field Data Type Reference

April 30, 2013 in Microsoft Access

This page lists every possible field data type that a native Access (Access Database Engine) database can contain. It also shows which methods can be used to create fields of the given type. The information here applies to Access 2007+ (the ACE engine) but most information holds true for earlier versions as well. Contents List of Data Types Examining Data Types Creating Fields, by Data Type List of Microsoft Access Data Types Types of Types Officially, there are 13 primary data types in Microsoft Access. See SQL Data Types. There a number of subtypes, however, depending on how an individual
…read more

Values and References in VBA

April 25, 2013 in VBA

Visual Basic for Applications has a unique system of data types. One of the most fundamentally important concepts to understand is the difference between values and references in VBA, but it is very difficult to find clear explanations of this concept. I attempt to present one here. In this article I describe the difference between values and references, and between value types and reference types. In another article I will describe how the ByRef and ByVal keywords work. Synonyms When trying to make sense of this article in comparison with other articles and documentation, keep in mind that other sources
…read more

Arrays in VBA – Part 1: Types of Arrays

March 29, 2013 in VBA

There are many kinds of arrays in Visual Basic for Applications. Specifically, there are three fundamental attributes of each array, determined at compile time by how the array is declared: Element data type Number of dimensions Fixed or Dynamic Length Each of these attributes will be discussed in detail in this article. Element data type Just as scalar (non-array) variables have a data type, arrays have a data type that restricts what can go in the elements of the array. As we will see in a later post all about array assignments, the declared data type of an array is
…read more