If you write Microsoft Access databases with basic VBA code and no fancy Windows calls, you will find your database will run with Office 32 bit and Office 64 bit with no problems. But if you have used fancy windows library calls, you are likely to get this bug
Compile error The code in this project must be updated for use on 64-bit Visual Basic VBA7. Please review and update Declare statements and then mark them with the PrtSafe attribute.
This issue is discussed in detail here at Microsoft and here and Conditional Compilation is discussed here
Better still, here is some code that now works with both Office 32 bit and Office 64 bit VBA
'Office 64 Bit Code - Conditional Compile #If VBA7 Then '64 Bit code Public Declare PtrSafe Function etc etc #Else '32 Bit code Public Declare Function etc etc #End If
By Steve Hanzek July 31, 2019 - 3:51 pm
We are running windows 10 64 bit, with MS Office 64 bit. One of the users had an issue with their system, so Help Desk deleted and re-installed the newest version of Office 365. Suddenly she couldn’t run our Access front-end’s, or any of our spreadsheets.
Tracked down the issue to her needing ptrsafe in the code.
She was running 16.0.11727.20224.
I was running 16.0.11629.20246, and mine worked.
So I had the help desk delete my Office 365 and upgrade me to the newest version (which they say is coming to everyone eventually). My new version was 16.0.11425.20202, which was actually a downgrade. But my computer then had the same issues. Mine has since been updated automatically by our daily updates, and is 16.0.11727.20224… and still has the same issue.
I’ve tried sounding an alarm around the office that all of our spreadsheets could crash when the Help Desk rolls out the new version. But I’m surprised I don’t see anything about this on any of the tech sites.
What am I missing?
By X November 7, 2023 - 3:31 pm
So, in the 64 Bit code, is it OK to leave variables declared “As Long”. I read that they had to be changed to “As LongLong” or “As LongPtr”.