Code Must Be Updated for 64-Bit Systems

“The Code in This Project Must Be Updated for Use on 64-Bit Systems”

The full message reads: “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.”

This happens when a database written for 32-bit Office is opened in 64-bit Office. Microsoft 365 now installs 64-bit Office by default, so many older databases start failing the moment a company replaces its computers or upgrades Office.

Common causes

  • VBA code calls Windows functions using Declare statements written for 32-bit Office
  • The database uses 32-bit-only ActiveX controls or add-ins
  • The database is an .accde or .mde compiled in 32-bit Office, which can’t run in 64-bit Office

How to fix it

  1. Open the VBA editor (Alt+F11) and search the project for Declare.
  2. Add PtrSafe to each declaration, so Declare Function becomes Declare PtrSafe Function.
  3. Change pointer and handle variables (window handles, memory addresses) from Long to LongPtr. Adding PtrSafe alone silences the error, but the code can still crash if these types aren’t updated.
  4. If some users are still on 32-bit Office, wrap the declarations in #If VBA7 Then ... #Else ... #End If blocks so the same file works on both.
  5. Go to Debug > Compile and fix anything else it flags.
  6. For an .accde file, recompile it from the original .accdb using 64-bit Office.

This one is easy to get wrong

Updating Declare statements requires knowing which variables are pointers. A wrong guess can compile cleanly and still cause random crashes later. If your database has a lot of Windows API code, have someone experienced review it.

Need help with a 64-bit upgrade?

Updating legacy Access code for 64-bit Office is a regular part of our VBA Debugging & Enhancement work. Book a free diagnostic to get an estimate.

Scroll to Top