Declare statements without PtrSafe
Many Access applications call Windows functions directly through Declare statements, for example to open a file dialog, read the user name or work with the clipboard. In 64-bit Office every Declare statement must contain the PtrSafe keyword. Without it the VBA code does not compile and the application does not start.
Adding PtrSafe alone is not enough. Parameters and return values that hold handles or pointers must change from Long to LongPtr, and structures that contain them must be adjusted. If the application has to run in both 32-bit and 64-bit Office, conditional compilation with #If VBA7 or #If Win64 is needed. A wrong data type does not always cause an error straight away; it can lead to crashes later.
ActiveX controls and references
Forms often contain ActiveX controls, such as a tree view, list view, calendar or a third-party grid. Older and third-party controls are frequently available in 32-bit only, and the old calendar control was removed from Access altogether in Access 2010. In 64-bit Office such controls are missing or show an error.
The same applies to references in the VBA project to 32-bit DLLs or COM libraries, and to ODBC drivers: 64-bit Access needs 64-bit drivers for linked tables to SQL Server, Oracle or other databases.
Compiled files and other points
A few other points regularly come up:
Switching back to 32-bit Office is possible as a temporary measure, but it applies to all Office applications on a PC and only postpones the problem.
- An .mde or .accde compiled in 32-bit Office does not run in 64-bit Office; it must be recompiled from the source .mdb or .accdb in 64-bit Office
- Access 97 files cannot be opened in any current version, 32-bit or 64-bit
- Automation of Excel, Word or Outlook usually keeps working, but code that relies on 32-bit add-ins or tools does not
How to assess your application
Assessment starts with an inventory: how many Declare statements are there, which of them lack PtrSafe, which ActiveX controls appear on forms and which references does the VBA project use? Opening every module by hand takes time and is easy to get wrong in a large application.
The free scan counts the Windows API calls that are not ready for 64-bit, lists ActiveX controls, reads the references and shows links to Excel, Word or Outlook. Of compiled files (.mde/.accde) the source code cannot be read; then the original file is needed.
Frequently asked questions
How do I know whether Office is 32-bit or 64-bit?
In Access, go to File, Account, About Access. The first line of the window shows the version and whether it is 32-bit or 64-bit.
Is adding PtrSafe enough?
No. It removes the compile error, but pointer and handle parameters must also become LongPtr. Otherwise the code may compile and still crash or return wrong results.
Should we just install 32-bit Office?
That can work as a short-term solution. It applies to all Office applications on the PC and does not solve the underlying dependency on old code and controls.
Is the 64-bit issue a reason to modernise?
It is often a good moment to consider it. If the fixes are limited, adjusting the code is enough. If the application has other limitations too, a web application removes the dependency on the Office version entirely.
See in seconds how many API calls, ActiveX controls and references in your Access application need attention for 64-bit Office. The scan runs in your browser and your file is never uploaded. Questions? We answer in English or Dutch.
Start the free scan