The error message you're encountering suggests that the code in your Access project needs to be updated to work properly on 64-bit systems. Microsoft Access uses VBA (Visual Basic for Applications) as its programming language, and the error is specifically related to the "Declare" statements in your code.
In 64-bit versions of Microsoft Office, including Access, there are some changes in how these Declare statements should be written to ensure compatibility. To resolve this issue, you'll need to make the following modifications to your code:
- Open the VBA editor in Access by pressing Alt + F11.
- In the VBA editor, navigate to the module or code where the error occurs.
- Look for any Declare statements in the code. These are typically used to import functions from external libraries.
- For each Declare statement, you need to add the "PtrSafe" attribute at the end of the statement, just before the function name. Example: If you have a Declare statement like this:
Declare Function MyFunction Lib "MyLibrary.dll" Alias "MyAlias" (MyArguments) As MyType
Update it to:Declare PtrSafe Function MyFunction Lib "MyLibrary.dll" Alias "MyAlias" (MyArguments) As MyType
By adding the "PtrSafe" attribute, you're indicating to the compiler that the Declare statement is compatible with both 32-bit and 64-bit systems.
Once you've made the necessary modifications, save the changes and try running your code again. It should now work correctly on 64-bit systems without the compile error.