Results 1 to 3 of 3
  1. #1
    oldtiredjeffro is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    7

    image paths in access 2010

    I want an image to display in an Access 2010 form. Rather than OLE, I want to use the path name in a table to load the image, however I want to make the database "portable", so the question is "How do I keep the path directed to where the images are relative to the table so the database will function on numerous machines?". For example, if the path is C:...\...\Image1, the image will not display if I burn the database to disc and try to open it on my CD drive, "D".

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    I think the only way to do this would be to prompt the user to either type in or much better, navigate to the required directory, and then keep the directory in a small table. You could have a button on a form to allow them to change it if they wanted to.

    Here is a function I use to do just that:

    Code:
    Function Change_File_Location(Current_Location As Variant, Dialog_Title As String) As Variant
      Dim CurrentProcedure As String
      On Error GoTo ErrProc
      CurrentProcedure = "Change_File_Location"
      Dim fd As FileDialog
      Dim ReturnPath As Variant, ReturnValue As Integer
      Set fd = Application.FileDialog(msoFileDialogFolderPicker)
      '
      '  Initialize the directory with the current value
      '
      If IsNull(Current_Location) Then
        fd.InitialFileName = "C:\"
      Else
        fd.InitialFileName = Current_Location
      End If
      fd.title = "Select a folder for " & Dialog_Title
      ReturnValue = fd.Show
      If ReturnValue <> 0 Then
        '
        ' Dialog was not closed with "Cancel"
        '
    '    MsgBox "Returned Value = " & ReturnValue
        Change_File_Location = fd.SelectedItems(1)
      Else
        '
        ' Return value is the same as the initial value
        '
        Change_File_Location = Current_Location
      End If
      Set fd = Nothing
       
      Exit Function
    ErrProc:
       Process_Error CurrentForm, CurrentProcedure, Err.Description
    End Function
    Process_Error is code I use to display any errors - you don't need it here

    John

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,643
    Are these images moved with the database into the same folder?

    Could grab the folder path with:

    CurrentProject.Path
    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.

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

Similar Threads

  1. Insert Image in Access 2010 ???
    By cowboy in forum Access
    Replies: 5
    Last Post: 03-18-2014, 08:22 AM
  2. Controls for OLE Image Access 2010
    By Mnelson in forum Access
    Replies: 1
    Last Post: 07-10-2012, 06:19 PM
  3. Access 2010 - Launch DB from 2 different paths
    By sunnie_joe in forum Programming
    Replies: 1
    Last Post: 04-19-2012, 06:11 AM
  4. Replies: 1
    Last Post: 01-05-2012, 02:34 PM
  5. background image on Access 2010 form
    By lkspitz in forum Forms
    Replies: 2
    Last Post: 06-16-2011, 08:35 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