Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581

    Convert to 64 bit

    My database is 32 bit. Sadly, I needed it to be 64 bit. Microsoft has told me that it can be converted over to 64 bit, but gave me directions to ask a forum on how to do it. Anyone have an idea on this?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    you can run 32bit in 64.
    you can set the definition of functions using the code to use the correct definition to use:

    Code:
    #if Win64 then
       Declare PtrSafe Function MyMathFunc Lib "User32" (ByVal N As LongLong) As LongLong
    #else
       Declare Function MyMathFunc Lib "User32" (ByVal N As Long) As Long
    #end if

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    I've always used this version https://msdn.microsoft.com/en-us/vba...trsafe-keyword
    not to say that the other wouldn't work. At least the link will shed more light on the subject matter and provide the keyword for further searching if desired.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Phillip Stiefel has done a very good guide to converting from 32-bit to 64-bit at https://codekabinett.com/rdumps.php?...ion-vba-64-bit
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    I've been trying to understand that article. I'm sure it's excellent. It looks like it was very well researched. I'm still learning VBA and didn't quite understand it. It looks like there is supposed to be a code to make 32 bit work with the 64 bit. I didn't understand the VBA7 and the code to make it work right.

  6. #6
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    Ranman, where do I put that code? I'm not familiar with the "definitions of functions"

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Ranman's code was just an example.
    If you post one of the declaration sections from your modules, one of us can convert it to get you started.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    This is the one that gives me the error:

    'http://support.microsoft.com/kb/888695

    Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
    "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long

    Private Type OPENFILENAME
    lStructSize As Long
    hwndOwner As Long
    hInstance As Long
    lpstrFilter As String
    lpstrCustomFilter As String
    nMaxCustFilter As Long
    nFilterIndex As Long
    lpstrFile As String
    nMaxFile As Long
    lpstrFileTitle As String
    nMaxFileTitle As Long
    lpstrInitialDir As String
    lpstrTitle As String
    flags As Long
    nFileOffset As Integer
    nFileExtension As Integer
    lpstrDefExt As String
    lCustData As Long
    lpfnHook As Long
    lpTemplateName As String
    End Type

    Function LaunchCD(strform As Form, Optional InitialFolder As String = "C:") As String
    Dim OpenFile As OPENFILENAME
    Dim lReturn As Long
    Dim sFilter As String
    OpenFile.lStructSize = Len(OpenFile)
    OpenFile.hwndOwner = strform.Hwnd
    sFilter = "All Files (*.*)" & Chr(0) & "*.*" & Chr(0) & _
    "JPEG Files (*.JPG)" & Chr(0) & "*.JPG" & Chr(0)
    OpenFile.lpstrFilter = sFilter
    OpenFile.nFilterIndex = 1
    OpenFile.lpstrFile = String(257, 0)
    OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1
    OpenFile.lpstrFileTitle = OpenFile.lpstrFile
    OpenFile.nMaxFileTitle = OpenFile.nMaxFile
    OpenFile.lpstrInitialDir = InitialFolder
    OpenFile.lpstrTitle = "Select a file using the Common Dialog DLL"
    OpenFile.flags = 0
    lReturn = GetOpenFileName(OpenFile)
    If lReturn = 0 Then
    MsgBox "A file was not selected!", vbInformation, _
    "Select a file using the Common Dialog DLL"
    Else
    LaunchCD = Trim(Left(OpenFile.lpstrFile, InStr(1, OpenFile.lpstrFile, vbNullChar) - 1))
    End If
    End Function

  9. #9
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    I have that API in several old databases that I no longer use
    You convert by using conditional compiling adding PtrSafe and LongPtr instead of Long
    :
    Code:
    #If VBA7 Then 'use PtrSafe  
        Private Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias _
            "GetOpenFileNameA" (pOpenfilename As OpenFilename) As Long
    #ElseIf Win64 Then 'need datatype LongPtr
        Private Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias _
            "GetOpenFileNameA" (pOpenfilename As OpenFilename) As LongPtr
    #Else '32-bit Office
        Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
            "GetOpenFileNameA" (pOpenfilename As OpenFilename) As Long
    #End If
    NOTE:
    1. I also have a variation of this which uses Boolean instead of Long
    2. Some authors such as Phillip Stiefel combine the VBA7 & Win64 code into one section

    In my databases, no changes were made to the Type declarations and from memory, it works fine (not tested recently)
    However be warned that if you use Type MSA_OPENFILENAME code with that API, it doesn't work in 64-bit

    Hope that helps
    Last edited by isladogs; 07-23-2018 at 02:43 PM. Reason: Modified text
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #10
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    This is a code from Microsoft. I just copied and pasted it. It works fine in 32 bit, doesn't like 64. How do I use the code you wrote to make it work? Do I just put it in front of it? Or do I replace part of it? This is new ground for me.

  11. #11
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    Your variation worked better than this one?

  12. #12
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Quote Originally Posted by UT227 View Post
    This is a code from Microsoft. I just copied and pasted it. It works fine in 32 bit, doesn't like 64. How do I use the code you wrote to make it work? Do I just put it in front of it? Or do I replace part of it? This is new ground for me.
    Just replace the first 2 lines of your code with what I provided and leave everything else as it was.
    It should then work in both 32-bit and 64-bit

    I don't understand what you've written in post #11
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  13. #13
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    You said that you have your own variation of this code. I was wondering if it worked better.

  14. #14
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    I replaced the first two lines. It's still in red. Does that matter? I think that means that there's something wrong with it.
    Click image for larger version. 

Name:	module.jpg 
Views:	10 
Size:	91.2 KB 
ID:	34829

  15. #15
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    It's meant to look like that.
    The 32-bit code is always shown in red using 64-bit Access.

    Both the Boolean and long versions of this code worked equally well ...as far as I can remember.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. convert to web
    By Jen0dorf in forum Access
    Replies: 3
    Last Post: 12-22-2017, 12:18 AM
  2. to convert SQL to VBA!!!!!!!!!!!
    By mathhero in forum Access
    Replies: 1
    Last Post: 10-30-2015, 07:34 AM
  3. convert to mde
    By linoreale in forum Access
    Replies: 5
    Last Post: 05-14-2015, 09:09 AM
  4. Convert to DD:HH:MM:SS
    By denknee in forum Programming
    Replies: 2
    Last Post: 10-06-2014, 04:55 PM
  5. Can you convert .mdb to .wdb??
    By DeeMax45 in forum Access
    Replies: 2
    Last Post: 01-22-2012, 06:11 PM

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