MS-Access / Getting Started

Using LongLong Data Types

Besides LongPtr, Access 2010 Visual Basic includes another new data type called LongLong. The LongLong data type can hold an 8-byte signed integer value. The LongLong data type is useful when you are interacting with APIs on a computer running 64-bit Windows that consume or return 64-bit values. The LongLong data type is available only with the 64-bit version of Visual Basic. If you to use the LongLong data type in a 32-bit version of Access 2010, you'll receive a compile error. Table-7 shows a summary of the VBA7 language updates.

Table-7 Summary of VBA7 Language Updates
NameTypeDescription
PtrSafeKeywordAsserts that a Declare statement is targeted for 64-bit systems. This is required on 64-bit systems.
LongPtrData TypeType alias that maps to Long on 32-bit systems or LongLong on 64-bit systems
LongLongData Type8 byte data type that is available only on 64-bit systems. Supports integer numbers in the range of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. LongLong is a valid declared type only on 64-bit systems. In addition, you cannot implicitly convert a LongLong to a smaller type. For example, you cannot assign a LongLong data type to a Long. Explicit coercions are allowed, so in the previous example, you could apply CLng to a LongLong and assign the result to a Long on 64-bit platforms.
^LongLong type-declaration characterExplicitly declares a literal value as a LongLong. This is required to declare a LongLong literal that is larger than the maximum Long value. If you don't explicitly declare the value, Access converts it to a Double.
CLngPtrType conversion functionConverts a simple expression to a LongPtr. This is valid on 64-bit platforms only.
CLngLngType conversion functionConverts a simple expression to a LongLong data type. This is valid on 64-bit platforms only.
vbLongLongVarType constantConstant used with the VarType function. Note that there is no vbLongPtr, since LongPtr is a mapping to Long and LongLong and therefore is not really a separate type.
DefLngPtrDefType statementSets the default data type for a range of variables as LongPtr.
DefLngLngDefType statementSets the default data type for a range of variables as LongLong.

Working with .MDE and .ACCDE files in 64-Bit Environments

Unfortunately, the binary executable form of Visual Basic is not compatible between 32-bit and 64-bit versions of Visual Basic. Normally, this is not a problem when you are using an .mdb or .accdb database; Visual Basic is designed to recompile from source code if it finds the binary executable form stored within the database is the wrong type. For .mde and .accde databases, however, this presents a problem because .mde and .accde files have no source code. As a result, .mde and .accde databases created with 32-bit Access 2010 can only be used with 32-bit versions of Access, and .mde and .accde databases created with 64-bit Access 2010 can only be used with 64-bit versions of Access. If you are distributing an application that needs to be run with both 32-bit and 64-bit versions of Access, you must create and distribute separate 32-bit and 64-bit .mde and .accde databases.

Note:
The controls in the MSComCtl and MSComCtl2 libraries were not ported to 64-bit in Office 2010. You cannot use any of the following controls in a 64-bit environment of Office 2010:

  • MSComCtl Control Library: TabStrip, Toolbar, StatusBar, ProgressBar, TreeView, ListView, ImageList, Slider, and ImageComboBox
  • MSComCt2 Control Library: Animation, UpDown, MonthView, DateTimePicker, and FlatScrollBar
[Previous] [Contents]