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 UpdatesName | Type | Description |
---|---|---|
PtrSafe | Keyword | Asserts that a Declare statement is targeted for 64-bit systems. This is required on 64-bit systems. |
LongPtr | Data Type | Type alias that maps to Long on 32-bit systems or LongLong on 64-bit systems |
LongLong | Data Type | 8 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 character | Explicitly 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. |
CLngPtr | Type conversion function | Converts a simple expression to a LongPtr. This is valid on 64-bit platforms only. |
CLngLng | Type conversion function | Converts a simple expression to a LongLong data type. This is valid on 64-bit platforms only. |
vbLongLong | VarType constant | Constant 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. |
DefLngPtr | DefType statement | Sets the default data type for a range of variables as LongPtr. |
DefLngLng | DefType statement | Sets 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
In this tutorial:
- Visual Basic Fundamentals
- Visual Basic Development Environment
- Visual Basic Editor Window
- Relationship Between Access and Visual Basic
- Visual Basic Debugging Tools
- Working with the Watch Window
- Variables and Constants
- Variable and Constant Scope
- Declaring Constants and Variables
- Dim Statement
- Enum Statement
- Event Statement
- Private Statement
- Public Statement
- Static Statement
- Type Statement
- Collections, Objects, Properties, and Methods
- DAO Architecture
- ADO Architecture
- Referencing Collections, Objects, and Properties
- Use Exclamation Points and Periods
- Assigning an Object Variable-Set Statement
- Object Methods
- Manipulating Complex Data Types Using DAO
- Working with ADO Recordsets
- Functions and Subroutines
- Sub Statement
- Understanding Class Modules
- Property Let
- Property Set
- Controlling the Flow of Statements
- Do...Loop Statement
- For...Next Statement
- For Each...Next Statement
- If...Then...Else Statement
- RaiseEvent Statement
- Stop Statement
- With...End Statement
- Running Macro Actions and Menu Commands
- Executing an Access Command
- Trapping Errors
- Working with 64-Bit Access Visual Basic for Applications
- Using LongPtr Data Types
- Supporting Older Versions of Access
- Using LongLong Data Types