Solved VPA to change from 64 bit to 32 bit

Mercy Mercy

Member
Local time
Today, 09:59
Joined
Jan 27, 2023
Messages
87
Hi everyone. I created a database using 64 bit. When I use in 32 bit, it can't work.
Is there a VBA code to change from 64 bit to 32 bit. If so, I am really begging you to assist me. Thanks in advance. God bless you all.
 
Are you asking for a code to do the conversion for you? Otherwise, there are some example code you can use to help you make the conversion yourself.
 
Are you asking for a code to do the conversion for you? Otherwise, there are some example code you can use to help you make the conversion yourself.
Kindly assist me with that example code. Thanks in advance.
 
What can’t work? If you are using API’s then using Longptr instead of longlong should be sufficient.

If you are providing a .accde then you do need to compile as 32bit so you’ll need a 32bit version of access to do that

or perhaps the issue is the 32bit access trying to run your app is much earlier than the 64bit version and the 64bit version uses features not available in the earlier version
 
Take a look at some of the links in the Similar Threads list below.
I found this code somewhere. I hope it will work.
👇👇👇👇👇👇
Private Declare PtrSafe Function FunctionName () as long

If VBA7 Then
Private Declare PtrSafe Function GetKeyState Lib "user32" ( ByVal nVirtKey As Long) As Integer
#Else
Private Declare Function GetKeyState Lib "user32" ( ByVal nVirtKey As Long) As Integer
#End If
 
Hi everyone. I created a database using 64 bit. When I use in 32 bit, it can't work.
Is there a VBA code to change from 64 bit to 32 bit. If so, I am really begging you to assist me. Thanks in advance. God bless you all.
Here are some links to presentations on adapting VBA to run under both 32 bit and 64 bit Access, and other resources that will help you.


 
If you only have that one API, it will work if you add the missing # at the start of
#If VBA7 Then
 
I created a database using 64 bit. When I use in 32 bit, it can't work.
Why can't it work?
  • If you are distributing an AccDE file and still got the AccDB file, you must recompile with 32bit Access to create a 32bit AccDE.
  • If you are distributing an AccDB, it should work out-of-the-box in 32bit Access.
  • If you are distributing an AccDE file and you lost the AccDB file you are in serious trouble. - Independently of the 64/32bit issue.
 
Why can't it work?
  • If you are distributing an AccDE file and still got the AccDB file, you must recompile with 32bit Access to create a 32bit AccDE.
  • If you are distributing an AccDB, it should work out-of-the-box in 32bit Access.
  • If you are distributing an AccDE file and you lost the AccDB file you are in serious trouble. - Independently of the 64/32bit issue.
As Sonic says, the # compiler directive works in either version if you have the code. However if you compile it, then it compiles to the bitness of access, and will only work on that version thereafter.
 
However if you compile it, then it compiles to the bitness of access, and will only work on that version thereafter.
Access always compiles to the bitness of the Access installation doing the compilation. - Regardless of compiler directives.
In an AccDB the code will be recompiled if opened with different bitness, in AccDE the code will not work.
 
I put that the wrong way. I meant that it compiles the code option directives that match the bitness of the compiler. So a 64 bit compilation gives a final version that only contains the 64 bit directives, and will no longer run on 32bit access.
 
I use a simple home-grown Access application to manage the process of saving a selected database to an ACCDE database - it recognises what bitness of Office is running and saves the relevant bitness ACCDE (I use an Access application so I can track Access development projects and generate versions and keep a history of work done - bit of overkill if you only have a few databases to save to ACCDE). I haven't lifted the bonnet for some time, but I recall I need to run the application in Office 64 and Office 32 if I need both ACCDE bitness versions - my next task is researching how to start Access in different bitness (I don't think it can be done).

There's some valuable information about building for both 64bit and 32bit at https://learn.microsoft.com/en-us/o...64-bit-visual-basic-for-applications-overview
 
use the .accdb.
compiling it to .accde (on x64) will not run on office x32.
 

Users who are viewing this thread

Back
Top Bottom