2010 db won't run on 64 bit installation (1 Viewer)

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
This question is unfortunately lacking in details, but thought I would throw it out there and see if anyone could start me in the right direction. The db runs happily on 32 bit Access installations and on 2010 Runtime, as well as 2013 32 bit Office installations. Now I need it to run on a computer with full 2013 Office Pro 64 bit installed and it errs. It seems to be objecting to something in the vba code. Unfortunately, I am not in possession of the computer and am relying on very non technical description of what is happening. Thanks for any ideas.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 08:38
Joined
Sep 12, 2006
Messages
15,651
MS actually recommending installing 32bit access.

It would be a lot easier to reinstall 32-bit office on the problem machine, I think. Otherwise you will end up having to duplicate your work.
 

speakers_86

Registered User.
Local time
Today, 03:38
Joined
May 17, 2007
Messages
1,919
This is why I try and steer clear of all references and APIs. If there are not many APIs in use, it could be easy to fix with a little bit of research.
 

sonic8

AWF VIP
Local time
Today, 09:38
Joined
Oct 27, 2015
Messages
998
This is why I try and steer clear of all references and APIs.
I agree on external references, but if declared properly, most APIs should not be a problem. The remaining few might require conditional compilation, which is somewhat more challenging. However, then they should be working reliably on any platform.
 

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
gemma-the-husky, I agree about reinstalling Office as a 32 bit and suggested that. However, this is a university owned laptop and their IT guy tried to tell my client that she would have to reformat her entire computer to be able to do that! :banghead: I sort of gave up after that. I finally suggested she find a friend with an out of service laptop and borrow that to use for this application.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:38
Joined
May 7, 2009
Messages
19,230
you can post the 32 bit version of the vba code, and we will help you transform it to be compatible with 32/64 bit system.
 

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
Oh, WOW! You guys are the best! Thank you so much for your offer to help. I am attaching the modules--let me know if you need anything else.
Ellen
 

Attachments

  • vba.accdb
    404 KB · Views: 71

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:38
Joined
May 7, 2009
Messages
19,230
please try
 

Attachments

  • vba.accdb
    416 KB · Views: 82

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
arnelgp, substituting your code for mine, it still runs just fine on my 32bit. On the 64 bit installation, the err was: ODBC-connection to '{MySQL ODBC 5.1 Driver}. I hadn't thought about the fact that a 32bit odbc connector driver was installed. So, a couple of questions:
If I have her install a 64 bit driver, does she have to uninstall the 32bit version first?
Since the odbc connection is made via code in Module1 in the openprog function, can I use "#if Win64 then" and reference the proper driver that way? I assume the error was because it couldn't find the proper driver? I am hoping not to have two separate versions of the program to maintain. The computer in question isn't in my possession, or experimenting would be much easier.

Thank you so much for your help!
 

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
I just looked at my connection string in module1, and the reference to the mysql connector doesn't specify 32bit. I assume, then, that uninstalling the 32bit and installing the 64 bit is all that should be necessary?
 

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
arnelgp, thank you for your help. I haven't heard back from the lady with the 64 bit--will let you know if and when. Meanwhile, I'll thank you for your input!
 

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
to arnelgp: Hooray! Thanks to you, the 64 bit Access is happily running my 32 bit version. Thank you, thank you, thank you!

One last question: will the following cause any problem? It would just make one screen a bit slicker, but could be omitted (or how to skip if 64bit?).
Code:
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
    Dim LinesToScroll   As Integer
    Dim hwndActiveControl As Long
    Dim i               As Long

    If ActiveControl.Properties.Item("controltype") = acTextBox Then
        hwndActiveControl = fhWnd(Screen.ActiveControl)
        For i = 1 To Abs(Count)
            SendMessage hwndActiveControl, WM_VSCROLL, IIf(Count < 0, SB_LINEUP, SB_LINEDOWN), 0&
        Next
    End If
End Sub
So glad to have this working, and like that I don't have to maintain two versions.
 

speakers_86

Registered User.
Local time
Today, 03:38
Joined
May 17, 2007
Messages
1,919
Funny, I use similar code and I just modified mine for the same reason. The below is currently working on 32, and I believe it will work on 64, but I need to test it again. Just call the scroll function from the form's mouse wheel event.

Code:
Option Compare Database
Option Explicit


'''http://www.arkmicrosystems.com/Articles_MSAccess/0022-How%20to%20use%20mouse%20wheel%20scrolling%20in%20MS%20Access.php

Private Const modename = "Scrolltextbox"
Public Const WM_VSCROLL = &H115
Public Const WM_HSCROLL = &H114
Public Const SB_LINEUP = 0
Public Const SB_LINEDOWN = 1
Public Const SB_PAGEUP = 2
Public Const SB_PAGEDOWN = 3

#If VBA7 Then
'  Code is running in the new VBA7 editor
     #If Win64 Then
        'Code is running in 64-bit version of Microsoft Office
        Private Declare PtrSafe Function focus Lib "User32" Alias "GetFocus" () As LongPtr
        Public Declare PtrSafe Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As LongPtr
     #Else
        'Code is running in 32-bit version of Microsoft Office
        Private Declare Function focus Lib "User32" Alias "GetFocus" () As Long
        Public Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
     #End If
#Else
    'Code is running in VBA version 6 or earlier
    Private Declare Function focus Lib "User32" Alias "GetFocus" () As Long
    Public Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
#End If

'Private Declare Function focus Lib "User32" Alias "GetFocus" () As Long
'Public Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long


#If VBA7 Then
'  Code is running in the new VBA7 editor
     #If Win64 Then
        'Code is running in 64-bit version of Microsoft Office
        Public Function funx(ctl As control) As LongPtr
            On Error Resume Next
            'ctl.SetFocus
            If err Then
                funx = 0
            Else
                funx = focus
            End If
            On Error GoTo 0
        End Function
     #Else
        'Code is running in 32-bit version of Microsoft Office
        Public Function funx(ctl As control) As Long
            On Error Resume Next
            'ctl.SetFocus
            If err Then
                funx = 0
            Else
                funx = focus
            End If
            On Error GoTo 0
        End Function
     #End If
#Else
    'Code is running in VBA version 6 or earlier
        Public Function funx(ctl As control) As Long
            On Error Resume Next
            'ctl.SetFocus
            If err Then
                funx = 0
            Else
                funx = focus
            End If
            On Error GoTo 0
        End Function
#End If


Public Sub Scroll(frm As Form, Count As Long)
    On Error GoTo err

    Dim LinesToScroll As Integer
    'Dim hwndActCtl As LongPtr


    #If VBA7 Then
        'Code is running in the new VBA7 editor
        #If Win64 Then
            'Code is running in 64-bit version of Microsoft Office
            Dim hwndActCtl As LongPtr
        #Else
            'Code is running in 32-bit version of Microsoft Office
            Dim hwndActCtl As Long
        #End If
    #Else
        'Code is running in VBA version 6 or earlier
        Dim hwndActCtl As Long
    #End If



    Dim a      As Long

    If frm.ActiveControl.Properties.Item("controltype") = acTextBox Then
        If frm.ActiveControl.Properties("enterkeybehavior") = True Or frm.ActiveControl.Properties("tag") Like "*scroll*" Then
            hwndActCtl = funx(Screen.ActiveControl)
            For a = 1 To Abs(Count)
                SendMessage hwndActCtl, WM_VSCROLL, IIf(Count < 0, SB_LINEUP, SB_LINEDOWN), 0&
            Next
        End If
    End If
    Exit Sub
err:
    If err.Number = 2474 Then Exit Sub           'the expression you entered requires the control to be in the active window
    Debug.Print "Error in scroll sub: " & err.Description
End Sub
 

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
Thanks speakers_86! I may give this a try. Let me know after you test it on a 64 bit installation if you run into any problems. I'll wait to be sure before I add it to the program and send it out to a lady who is running out of patience with me!
 

speakers_86

Registered User.
Local time
Today, 03:38
Joined
May 17, 2007
Messages
1,919
It works beautifully for me on both 32 and 64 bit Office.
 

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
speakers_86, I am finally back to working on this. Obviously, I really don't know what I am doing. I copied your code into module1. Then in code for the form in question, I tried to enter in the mouse wheel event:
Code:
call scroll (   ,   )
No matter what I try to put in the (), it errs. If instead I enter:
Code:
    If ActiveControl.Properties.Item("controltype") = acTextBox Then
        hwndActiveControl = funx(Screen.ActiveControl)
        For i = 1 To Abs(Count)
            SendMessage hwndActiveControl, WM_VSCROLL, IIf(Count < 0, SB_LINEUP, SB_LINEDOWN), 0&
        Next
    End If
and it runs in 32 bit but not in 64 bit.

This is not a necessary bit of code in this program, but I would really like to get it working. Thanks!
 

speakers_86

Registered User.
Local time
Today, 03:38
Joined
May 17, 2007
Messages
1,919
Don't use call. Just do:

Code:
Scroll Me, Count

Me is the form, you are passing the form itself to the scroll sub routine. Count is the argument provided in the mousewheel event.

Also, if you are making mde, you will need to create the mde twice, once using 32 bit office, and once using 64 bit office (I'm fairly certain anyway!)
 

ellenr

Registered User.
Local time
Today, 03:38
Joined
Apr 15, 2011
Messages
397
It works! It works! Thank you so much!
 

Users who are viewing this thread

Top Bottom