Can an Access 2003 app run in Access 2010 64 bit

djoosten

New member
Local time
Today, 17:10
Joined
Aug 30, 2011
Messages
7
I have an app the was written in Access 2003 and is used by customers using various versions of Access and various OS versions. Recently, one customer installed a new PC with Office 2010 64 bit and the Access application does not run on it. Everything I have found seems to suggest that the code needs to be changed to run on the 64 bit version, but if I change the code to run on the 64 bit version will it still run on the other environments. I have not had any problems with running it on a 64 bit OS like Vista or Win 7 as long as the Access version is 32 bit. Is it possible to write VBA code that works for both 32 bit and 64 bit Access? There are several API functions and ActiveX controls in the app. It appears that these need to be modified but how do I do that without breaking the app for the majority of users?
 
Focusing on the VBA part - yes it is very possible to write code that are compatible across both Access versions and for both n-bits platform. You'd use conditional compilation. An example:

Code:
#If VBA7 Then

Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" ( _
   ByVal hWnd As LongPtr, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, _
   ByVal nShowCmd As Long _
) As LongPtr

#Else

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" ( _
   ByVal hWnd As Long, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, _
   ByVal nShowCmd As Long _
) As Long

#End If

The VBA7 flag is only understood whenever you run VBA 7 (e.g. Office 2010). Since Office 2003 doesn't have VBA7, they run the part in the Else. That allow you to continue using API with no changes. For more sample of VBA7 declarations, Have a look at this Wiki.

ActiveX controls are probably the most problematic, however. At this point, there are no 64-bit replacements for common ActiveX controls such as TreeView, ListView and so on. You may have to either invest in a 3rd party ActiveX control that's available on both 32-bit and 64-bit platforms or scrap it although.

You also need both 32-bit and 64-bit ODBC driver and/or OLEDB provider if you're using linked ODBC tables or ADO in your code but that's actually least of problems - I don't know of any major RDBMS product that doesn't already offer a 64-bit counterpart for their driver/provider, but you do still need to have that available, nonetheless.
 
Thanks, Banana for your quick response.
So if I understand you correctly, if I add the conditional compilation code, the app can be compiled for both 32 bit and 64 bit Access versions. I assume that means that I would need to make the .MDE file for Access 64 bit on that machine and for 32 bit on a 32 bit Access machine. Is that correct?
 

Users who are viewing this thread

Back
Top Bottom