Legacy 07 to 2013 msAccess

FuzMic

DataBase Tinker
Local time
Tomorrow, 04:50
Joined
Sep 13, 2006
Messages
744
Hi guys

I have been avoiding new version of Access, my last version in use is ms 07

Want to venture forward, i try to open an mdb written in 32 bit msAccess 03 and it generate errors.

Decl function incompatible
It says that project must be updated to 64 bit as the msOffice is 64bit.

Question
If i use a 32 bit 2013 office, will this error occur?
I presume i can only update to 64 bit with msAccess which is 64 bit, right?
 
you must add code to switch to 32 or 64 bit for all your Declares:
Code:
#if Win64 then
   Declare PtrSafe Function MyMathFunc Lib "User32" (ByVal N As LongLong) As Long
#else
   Declare Function MyMathFunc Lib "User32" (ByVal N As Long) As Long
#end if
 
Yes Sir, just walking in the rain now. Thank you

Where to learn more on syntax of 64 bit declared
 
Thank you Colin

Ranman & Colin

Some thing new ..

When i open a module in Access03 with a PtrSafe, there is a Syntax error as there is no VBA7. The converse is true if i open with Access13, the old declare is in red.

However when i run it in Access03, there is no error. Is this what we expect?

One more question: Can i just add the keyword PtrSafe in the #If win64 repeating all the declare i use without changing any of the variable such as keeping Long not as LongLong.

Quote example

#If Win64 Then

Private Declare PtrSafe Function GetSystemMenu Lib "user32" (ByVal hwnd As LongLong, ByVal wRevert As Long) As LongLong
Private Declare PtrSafe Function EnableMenuItem Lib "user32" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long

#Else

Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal wRevert As Long) As Long
Private Declare Function EnableMenuItem Lib "user32" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long

#End If



Trying the above did not work as the vars seems to be unique for 32 or 64 bit, i think. Hence it must be redefine again for each branch.

I am stuck as there are Functions such as StartMouseWheel, where i am not sure it is available in the 64 bit branch. Any idea where to look for solutions.
 
Last edited:
As you are using A2003 for your 32-bit version you should add a third option:

#If VBA7 Then 'use PtrSafe
Private Declare PtrSafe Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal wRevert As Long) As Long
#ElseIf Win64 Then 'use PtrSafe & LongPtr
Private Declare PtrSafe Function GetSystemMenu Lib "user32" (ByVal hwnd As LongPtr, ByVal wRevert As Long) As Long
#Else
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal wRevert As Long) As Long
#End If

I've made a couple of other changes: LongPtr instead of LongLong (but both work).
LongPtr is only needed for pointers such as hwnd but I've found the code works even if it is used where not needed in #Win64 section

Each statement needs to be checked individually. I'm no expert on this and a few examples have caused me major grief
e.g. the class module in the Create System Tray Alerts thread (see link below).
Version 1.6 in post #14 does work in 64-bit though I confused myself by testing late at night...read the thread if you want to know why that mattered!

NOTE: Don't worry that the 32-bit code shows in red on a 64-bit system. That's normal!
 
Colin Thanks Heaps, appreciate your help to move up this learning curve. :)
 

Users who are viewing this thread

Back
Top Bottom