Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    willkr is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    110

    Question Upgrade from 32 bit to 64 bit


    I have a home budget system that I wrote about 10 years ago running on a 32 bit windows installation on an old desktop. I recently purchased a new laptop with 64 bit windows and my access DB won't run on the new system. The database application is about 2000 lines of code, but all the I/O is in a separate module. I think my old desktop system is starting to fail, so I desperately need to convert the application to 64 bit. Can someone point me to where I can learn about converting the application to 64 bit?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    32-bit Access should run with 64-bit Windows. Does for me. Is your db MDB or ACCDB?

    By 'separate module' do you mean a split design with Access front and back ends?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,275
    Same here, MDB and ACCDB. Are you now using 64bit access?
    Last edited by Welshgasman; 03-30-2023 at 04:22 AM.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    be sure to search all DECLARE statements and add the PTRSAFE block so the app can be used in either OS.

    Code:
    #If Win64 Then      'Public Declare PtrSafe Function
         Private Declare PtrSafe Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As LongPtr
     #Else
          Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
    #End If

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,127
    Quote Originally Posted by willkr View Post
    Can someone point me to where I can learn about converting the application to 64 bit?
    Just adding PtrSafe isn't enough to make APIs work in 64-bit
    For example, the API declaration in post #4 is incorrect and should be written:

    Code:
     #If VBA7 Then 
        Private Declare PtrSafe Function GetSystemMenu Lib "user32" (ByVal hWnd As LongPtr, ByVal bRevert As Long) As LongPtr
     #Else
          Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long 
    #End If
    Two good references for learning about 32 to 64-bit conversion:
    Windows API declarations in VBA for 64-bit - Codekabinett
    Access 32to64 Bit (thememydatabase.co.uk)
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    64 bit windows
    The bitness of the OS has no bearing on this - what matters is the bitness of Office?
    What Access version was used 10 years ago? If it was 97, that is your problem. Knowing what happens when you try to open the old db would help.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    KNicholson is offline Novice
    Windows 10 Office 365
    Join Date
    Mar 2023
    Posts
    6
    You can manually change the:
    Private Declare Function
    to
    Private Declare PtrSafe Function

    and/or add this to your database:

    Option Compare Database
    #If VBA7 Then
    Private Declare PtrSafe Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" _
    (ByVal lpRootPathName As String) As DriveType
    #Else
    Private Declare GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" _
    (ByVal lpRootPathName As String) As DriveType
    #End If
    Private Enum DriveType
    DRIVE_UNKNOWN = 0
    DRIVE_NO_ROOT_DIR = 1
    DRIVE_REMOVABLE = 2
    DRIVE_FIXED = 3
    DRIVE_REMOTE = 4
    DRIVE_CDROM = 5
    DRIVE_RAMDISK = 6
    End Enum

  8. #8
    willkr is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    110
    OK, I added the PtrSafe to all the declarations. Now I get a compile error in a module called LoadPictureGDIP. The code looks like this

    'Load image file with GDIP
    'It's equivalent to the method LoadPicture() in OLE-Automation library (stdole2.tlb)
    'Allowed format: bmp, gif, jp(e)g, tif, png, wmf, emf, ico
    Function LoadPictureGDIP(sFileName As String) As StdPicture
    Dim hBmp As Long
    Dim hPic As Long


    If Not InitGDIP Then Exit Function
    If GdipCreateBitmapFromFile(strPtr(sFileName), hPic) = 0 Then
    GdipCreateHBITMAPFromBitmap hPic, hBmp, 0&
    If hBmp <> 0 Then
    Set LoadPictureGDIP = BitmapToPicture(hBmp)
    GdipDisposeImage hPic
    End If
    End If


    End Function

    I get a compile error on the first executable line.

    I am in really over my head here guys, but I'll keep plugging on.

    Will

  9. #9
    willkr is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    110
    The error message I get is "Compile error:
    Type mismatch

    the thing highlighted is
    StrPtr
    on the second line after the Dim statements

    Will

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    What is StrPtr() function supposed to do? I don't see any advice in this thread about such a function.

    Maybe you should attach db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    willkr is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    110
    I've read through the Access32to64 document. It says, "Update all "Declare" statements to include PtrSafe and adjust their parameters from Long to LongPtr, where requred." How do I know where it is required and where it isn't?

  12. #12
    willkr is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    110
    I'll see what I can do to about attaching the db. It's a bit sensitive since it contains all my bank account and credit card information. After all, it is a home budget management system. It may be next week before I can get to it.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    I have Access 2010 32-bit running on 64-bit Windows10. I have not changed Long to LongPtr and db still works.

    Are you running Access 32-bit or Access 64-bit?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,127
    Handles/pointers such as hBmp & hPic need to be changed from Long to LongPtr for use with 64-bit Access. Don't change all Long variables however.
    Other related changes may be needed so you should try to do the conversion yourself.

    Recommend you try Peter Cole's conversion utility from the second link in my previous post.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  15. #15
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,275
    Quote Originally Posted by June7 View Post
    Are you running Access 32-bit or Access 64-bit?
    Asked in post #3 and never responded to?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. When to Upgrade
    By Ellpee in forum Access
    Replies: 2
    Last Post: 04-19-2018, 01:21 PM
  2. What Happens When I Upgrade?
    By jsheffie in forum General Chat
    Replies: 1
    Last Post: 04-09-2014, 09:46 PM
  3. Move and upgrade
    By nickyburnell in forum Access
    Replies: 1
    Last Post: 04-14-2013, 06:50 PM
  4. Should we upgrade
    By bapman in forum Database Design
    Replies: 5
    Last Post: 01-08-2012, 01:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums