Results 1 to 4 of 4
  1. #1
    Silvera is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Location
    California
    Posts
    65

    Attach pictures to a database with path and file name.

    I was directed to an old tutorial that seemed great but when I tried to create my own based on what was shown, it kept crashing at the strangest places.

    I'm at my office now (the program will be for office use) and I cannot even run what I was debugging at home because of a 64-bit issue. It crashed at this code:

    Private Declare Function GetTempPath Lib "Kernel32" Alias "GetTempPathA"



    "Function" was the highlighted word when it crashed.

    Since it was from the tutorial I really do not know what they were trying to do.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you probably want to alter the functions to detect 32 vs 64 using the PtrSafe word.

    Code:
    
    #If Win64 Then
        Private Declare PtrSafe Function GetTempPath Lib "Kernel32" Alias "GetTempPathA"
    #Else
         Private Declare Function GetTempPath Lib "Kernel32" Alias "GetTempPathA"
    #End If

  3. #3
    Silvera is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Location
    California
    Posts
    65
    Thank you for the quick response

    Quote Originally Posted by ranman256 View Post
    you probably want to alter the functions to detect 32 vs 64 using the PtrSafe word.

    Code:
    
    #If Win64 Then
        Private Declare PtrSafe Function GetTempPath Lib "Kernel32" Alias "GetTempPathA"
    #Else
         Private Declare Function GetTempPath Lib "Kernel32" Alias "GetTempPathA"
    #End If

  4. #4
    Silvera is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Location
    California
    Posts
    65
    Quote Originally Posted by Silvera View Post
    Thank you for the quick response
    I got the code running with you help and immediately hit another set of code the stopped it from running, so I edited it to this:

    #If Win64 Then
    Declare PrtSafe Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
    Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean
    Declare PrtSafe Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
    Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
    Declare PrtSafe Function CommDlgExtendedError Lib "comdlg32.dll" () As Long
    #Else
    Declare Function aht_apiGetOpenFileName Lib "comdlg32.dll" _
    Alias "GetOpenFileNameA" (OFN As tagOPENFILENAME) As Boolean
    Declare Function aht_apiGetSaveFileName Lib "comdlg32.dll" _
    Alias "GetSaveFileNameA" (OFN As tagOPENFILENAME) As Boolean
    Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long
    #End If

    This time "PtrSafe" was the stopping point. I'm guessing since was not a "Private" declaration another term is needed.

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

Similar Threads

  1. Replies: 2
    Last Post: 07-28-2015, 03:07 PM
  2. How to attach PDF file to an Access database
    By Ayiramala in forum Access
    Replies: 4
    Last Post: 01-09-2015, 11:59 AM
  3. Replies: 2
    Last Post: 05-25-2012, 07:36 AM

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