Solved VPA to change from 64 bit to 32 bit (1 Viewer)

Mercy Mercy

Member
Local time
Today, 11:21
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:21
Joined
Oct 29, 2018
Messages
21,473
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.
 

Mercy Mercy

Member
Local time
Today, 11:21
Joined
Jan 27, 2023
Messages
87
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.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 09:21
Joined
Feb 19, 2013
Messages
16,612
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
 

Mercy Mercy

Member
Local time
Today, 11:21
Joined
Jan 27, 2023
Messages
87
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
 

GPGeorge

Grover Park George
Local time
Today, 01:21
Joined
Nov 25, 2004
Messages
1,867
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.


 

isladogs

MVP / VIP
Local time
Today, 09:21
Joined
Jan 14, 2017
Messages
18,221
If you only have that one API, it will work if you add the missing # at the start of
#If VBA7 Then
 

sonic8

AWF VIP
Local time
Today, 10:21
Joined
Oct 27, 2015
Messages
998
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.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 09:21
Joined
Sep 12, 2006
Messages
15,656
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.
 

sonic8

AWF VIP
Local time
Today, 10:21
Joined
Oct 27, 2015
Messages
998
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.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 09:21
Joined
Sep 12, 2006
Messages
15,656
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.
 

GregDataReno

New member
Local time
Today, 18:21
Joined
Jul 4, 2016
Messages
18
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:21
Joined
May 7, 2009
Messages
19,243
use the .accdb.
compiling it to .accde (on x64) will not run on office x32.
 

Users who are viewing this thread

Top Bottom