Asked by:
VB for 64-bit computers

Question
-
I developed an Access 2010 application for use at the church where I work. I had one of my co-workers open the database because I was going to show him something that I thought would be of use to him. He has a 64-bit computer and when he opened it up, it went directly to the VB editor and displayed a message something like, "This code needs to be rewritten for 64-bit computers". What rewriting needs to be done, and if it were done, would 32-bit computers be able to use the database?
Jill Marlow
Wednesday, February 8, 2017 3:38 AM
All replies
-
Hi Jill, Do you use any API? If you do, they will have to be rewritten for 64-bit Access. Do you deploy ACCDE versions of your db?Wednesday, February 8, 2017 5:34 AM
-
If there is code identified in the VB Editor you may want to post it so we can see what will need to be converted/added. There are compiler directives that can indicate which code to run based upon the version of Windows the app is running under.
http://www.utteraccess.com/wiki/index.php/Conditional_Compilation
Paul ~~~~ Microsoft MVP (Visual Basic)
Wednesday, February 8, 2017 9:13 AM -
Just to clarify, this error has nothing to do with the Windows bitness, but is entirely dependent on the MS Office/MS Access bitness. Moreover, unless there is a specific need, I'd uninstall the Office and reinstall the 32 bit version as that is the recommended configuration from Microsoft themselves! This would resolve your entire problem.
Daniel Pineault, 2010-2016 Microsoft MVP
Professional Support: http://www.cardaconsultants.com
MS Access Tips and Code Samples: http://www.devhut.net- Edited by Daniel Pineault (MVP)MVP Wednesday, February 8, 2017 2:20 PM
Wednesday, February 8, 2017 2:19 PM -
The times I've encountered this message had to do with vba routines that used functions coming from windows dll's. The code below shows a random 'Declare' statement that I've come across and the method using Conditional compilation (#If Then #Else #EndIF) used to handle both 64bit and 32 bit Windows. THe main difference is in the ptrsafe declaration for 64bit machines.
#If VBA7 Then Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long #Else Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName as String, ByVal lpWindowName As Long) As Long #End If
-MainSleuth You've Got It, Use It! Engineering, Science, Statistics Solutions http://ToolSleuth.com. For any reply that either helps to answer your question or is the answer, please mark it as helpful or as the answer so others with the same question will have an answer quickly.
- Edited by MainSleuth Wednesday, February 8, 2017 3:27 PM
- Proposed as answer by Chenchen Li Thursday, February 9, 2017 4:49 AM
Wednesday, February 8, 2017 3:18 PM -
Where would I put this code? Would I have to put it at the beginning of every procedure in the database?
Jill Marlow
Friday, February 10, 2017 1:32 AM -
I'll try that when I get a chance. Thanks.
Jill Marlow
Friday, February 10, 2017 1:36 AM -
Hi, Jill
For more information about Compatibility Between the 32-bit and 64-bit Versions of Office 2010, you could visit
https://msdn.microsoft.com/en-us/library/office/ee691831(v=office.14).aspx
https://msdn.microsoft.com/en-us/library/office/gg264421.aspx
The articles above gives good explanation and samples about how to declare statements with/without the PtrSafe attribute to make it compatible with 32bit and 64bit office 2010.
Regards,
Celeste
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Friday, February 10, 2017 3:13 AM -
You would find Declare statements at the top of modules (or classes, etc) that depend on other dlls, and use the #If #Else #EndIf structure for the declare statements.
-MainSleuth You've Got It, Use It! Engineering, Science, Statistics Solutions http://ToolSleuth.com. For any reply that either helps to answer your question or is the answer, please mark it as helpful or as the answer so others with the same question will have an answer quickly.
Friday, February 10, 2017 2:40 PM -
Where would I put this code? Would I have to put it at the beginning of every procedure in the database?
Jill Marlow
The link I posted a couple of days was pretty well documented. You may want to read through it and then identify the API function call declarations in your code for modification.
If you don't have any Declare statements in your code then we will need to look at other possibilities.
Paul ~~~~ Microsoft MVP (Visual Basic)
Friday, February 10, 2017 3:18 PM