In depth · Compatibility
64-bit Office: how to fix an Access application that no longer opens
A new PC, a fresh Office installation, and the application that worked yesterday shows an error as soon as it opens. In the vast majority of cases the cause is the same: the switch to 64-bit Office, now the default installation.

Up to Office 2016, the default installation was 32-bit. Since Office 2019 and Microsoft 365, the 64-bit version installs by default, as Microsoft's documentation states. Access applications written ten or fifteen years ago were never designed for that environment. As long as PCs kept 32-bit Office, nothing showed. Every PC replaced with a 64-bit one now brings the problem to the surface.
This guide explains how to fix it, step by step. To find out first, in a single run, everything that breaks and where, use the 64-bit Office compatibility check tool.
The message that blocks everything
The code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute.
Before fixing things by hand, it helps to check your application's 64-bit compatibility: the complete list of declarations and references to update, form by form.
This message appears as soon as the VBA code contains an old-style Declare statement (a call to a Windows function). The VBA compiler then refuses to compile the module: depending on where that code lives, a form, a button or the whole application stops working.
Why adding PtrSafe is not enough
It is tempting to add the PtrSafe keyword everywhere to silence the message. It is a common mistake. As Microsoft points out, PtrSafe only asserts that the declaration is ready for 64-bit; it does not make it correct. If a parameter or return value holds a memory address or a window "handle", it must change from Long (4 bytes) to LongPtr (8 bytes in 64-bit).
Without that fix, the code compiles but addresses get truncated. The consequences are unpredictable: a wrong value, a form that freezes, or Access closing abruptly, sometimes long after the faulty call. That is worse than the error message, because the failure no longer points to its cause.
| Element | In 32-bit | For 64-bit |
|---|---|---|
| API declaration | Declare Function … | Declare PtrSafe Function … |
| Addresses, handles (hWnd, hDC…) | Long | LongPtr |
| 64-bit integers | does not exist | LongLong (64-bit only) |
| Structures (Type … End Type) with pointers | members as Long | members as LongPtr, check alignment |
| Code for both versions | — | #If VBA7 Then … #Else … #End If |

Other causes to check
Declare statements are not the only thing that breaks in 64-bit:
- Old ActiveX controls: some controls placed on forms (calendars, grids, third-party toolbars) only exist in 32-bit. The form no longer opens, or the control is blank.
- Compiled ACCDE or MDE files: a file compiled with 32-bit Access will not open in 64-bit Access. You have to go back to the source file (.accdb) and recompile it.
- External libraries and DLLs referenced by the project, which must exist in a 64-bit version.
- Data drivers (ODBC, OLE DB) used by linked tables, which must match Office's bitness.
Fixing an application, step by step
- Inventory every Declare statement, ActiveX control and project reference.
- Fix the declarations: PtrSafe, then LongPtr for every address or handle, including in structures and in the variables that receive those values.
- Use conditional compilation (#If VBA7) if the application must still run on 32-bit PCs.
- Replace ActiveX controls that do not exist in 64-bit with native Access controls.
- Compile the whole project (Debug > Compile) on a 64-bit PC, then test every affected form and button.
- Recompile the ACCDE files from the corrected source file.
The last step is the one most often skipped: a module that compiles is not a module that works. Only actually running every form and button shows that the fix is complete. This ties in with the broader subject of the technical debt of Access applications.
Staying on 32-bit: a stopgap
Installing 32-bit Office is still possible and sidesteps the problem. It is a reasonable short-term answer, as long as you know it only buys time: it imposes a special configuration on every new PC, limits the memory available to Access and does nothing to stop the debt growing. It should come with a plan to fix or migrate the application.
For the message itself, see the PtrSafe compile error and a reference marked MISSING in the Access error reference.
Sources
- 64-bit Visual Basic for Applications overview — Microsoft Learn
- PtrSafe keyword — Microsoft Learn