Read this to feel PtrSafe about Office 64 Bit compatibility

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

 

 

About Garry Robinson

He is the guy who originally put this Smart Access web site together. Head to www.gr-fx.com.au for more about him and his company. His main claim to fame is winning the Microsoft MVP award for services to MS Access from 2006 to 2018.
This entry was posted in VBA. Bookmark the permalink.

2 Responses to "Read this to feel PtrSafe about Office 64 Bit compatibility"

Leave a Reply

Your email address will not be published. Required fields are marked *


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.