also user PTRSAFE for all DECLARE function so both Win32 & Win64 can open the db.
The Windows bitness is irrelevant. What matters is the Office bitness
The hWnd definition in the Win64 section of that API declaration example is incorrect. It needs to be LongPtr
Better to use #If VBA7 which works in both bitnesses for A2010 or later:
Code:
#If VBA7 Then 'for use with A2010 or later (32/64-bit)
Private Declare PtrSafe Function GetSystemMenu Lib "user32" (ByVal hWnd As LongPtr, ByVal bRevert As Long) As LongPtr
#Else 'for A2007 or earlier
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
#End If
If all users are running A2010 or later, that can be simplified to just:
Code:
Private Declare PtrSafe Function GetSystemMenu Lib "user32" (ByVal hWnd As LongPtr, ByVal bRevert As Long) As LongPtr
In case it helps, I have a series of 5 articles on this topic starting with: 32 to 64-bit Conversion (isladogs.co.uk)