Link to home
Start Free TrialLog in
Avatar of stephenlecomptejr
stephenlecomptejrFlag for United States of America

asked on

Need correct syntax for 32-bit and 64-bit Microsoft Access.

I'm trying to convert this 32 bit code into something that can be ran in both 32-bit and 64-bit Microsoft Access.
Based on this website and what I have - I tried to apply those changes but still getting red.  I know if I have the right syntax the red should be gone.

What is the correct syntax I need to incorporate to allow this to compile with no errors please?

Here's the code and provided a screen shot of the highlight:
[CODE]
#If VBA7 Then
  Private Declare PtrSafe Function LoadCursorLong Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
#End If
#If Win64 Then
   Private Declare Function LoadCursorLong Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
#End If

#If VBA7 Then
  Private Declare PtrSafe Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
#Else
  Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
#End If
[CODE]
helpwithcode.PNG
ASKER CERTIFIED SOLUTION
Avatar of Daniel Pineault
Daniel Pineault

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You might find this helpful:

Compatibility Between the 32-bit and 64-bit Versions of Office 2010
http://msdn.microsoft.com/en-us/library/ee691831(office.14).aspx

Read the section "Introducing the VBA 7 Code Base".    It describes the VBA7 and WIN64 compiler constants and how they should be used.  In brief, VBA7 means your executing code in A2010 and up.   WIN64 tells you if your operating in 32 or 64 bit mode (not for the OS, but for Office)

Also this:

https://www.microsoft.com/en-us/download/confirmation.aspx?displaylang=en&id=9970

 Covers all the modifications required on your existing 32 bit calls.

This:

https://docs.microsoft.com/en-us/previous-versions//aa383663(v=vs.85)

 is all the new 64 bit calls in windows.

Jim.
Avatar of stephenlecomptejr

ASKER

Thank you for your help.