Results 1 to 3 of 3
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    converting access 32 bit code to 64 bit

    Our office has an unfortunate mix of Access 32bit and 64 bit; unfortunate because the code had been written in 32.


    Till now, I've simply had everyone uninstall their 64bit Access from office, and download the 32bit runtime version... (admittedly, a patch, but effective)

    It's come time to bite the bullet and add the "what version are you using" code and all the related caveats (for another year or so, BOTH versions will exist within the user group)"; A while ago, when this problem first showed up, I was able to find several articles and forums on declarations, long vs. short, and all those necessary things to know / do... This morning, I'm finding stupid.

    Would someone direct me to the correct aisle in the library stacks?

    big thanks in advance,
    mark

  2. #2
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    OK... so I found some stuff about Declare PtrSafe Function and LongLong
    but, I'm not sure how to use it...

    I'm working in WIN32 and NOT VBA7
    The code will need to run in both 32Bit and 64Bit versions of ACCESS

    I've revise a line of code to handle both:

    _____________
    If VBA7 Then
    Private Declare PtrSafe Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long '? change to be LongLong ?
    Else
    Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
    "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    End If
    _____________

    and before I can even get to the LongLong stuff, I get this error:
    "Compile error: Expected: Sub or Function" on PtrSafe"

    maybe I need to be editing on a machine with VBA7? does it also need to be VBA7/64 bit?

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I really do not know because I do not use 64bit Office. I have been taking the wait and see approach. If your workgroup is hybrid 32 and 64 bit, the VBA that works for 32bit should work in the 64bit versions. There are a few exceptions where the code will not work.

    What VBA code is not working in 64bit versions? Is it just around DLL files like, advapi32.dll?

    If a machine is giving an error, search for the DLL file on the machine.

    Use the VBA7 constant to determine the version of Access but, PtrSafe is not going to help if the DLL file does not exist in the system.

    I would start there. Maybe look for an alternate method or a way to safely install the DLL. Does that DLL file exist on the machines running 64bit? Maybe it is a Windows Pro vs. Home or something.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 02-11-2014, 09:41 AM
  2. Replies: 7
    Last Post: 05-13-2013, 11:37 AM
  3. Converting SQL to VBA code
    By Davidyam in forum Access
    Replies: 3
    Last Post: 04-18-2012, 10:29 AM
  4. Replies: 5
    Last Post: 01-05-2012, 11:55 AM
  5. Converting a Code to Text
    By rmcafee in forum Programming
    Replies: 7
    Last Post: 09-13-2011, 08:52 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