MS Access Image Thumbnail or Display on Form From Attachment or URL

I am using MS Access 2016 and I am needing a way to have a button that I click and it will open up a file browser and allow me to navigate to a file capture that files path and then display it in my new Access Database Form. I would like to have a thumbnail image around 3x3 Inches in the upper corner of my product form. Best I wish I could get a image controller display so i can click on the image and then a image controller pops up and allows me to see it full resolution zoom in and out capabilities. I have been using a desktop application database software previously and it has these function but it is very unreliable so i am building my own.  Any help and direction would be very appreciated. I also keep all my images on a ec2 S3 bucket and I keep the URLs so I can link back to them if this can help. I have attached two photos here of the previous Database software I was using and my new Access Database Form. The next photo I attached is of the previous software image display enlarger Thank you all.
Database ComaprisonDatabase IMAGE ENLARGER
Dustin StanleyEntrepreneurAsked:
Who is Participating?
crystal (strive4peace) - Microsoft MVP, AccessConnect With a Mentor Remote Training and ProgrammingCommented:
to answer your question though, here is a function to return path\filename (maybe a better method than what I may have used in Contacts, can't remember what I did)
Function GetFile_Browse( _
   Optional psPathFile As String = "" _
   , Optional psDirectory As String = "" _
   , Optional psTitle As String = "" _
   , Optional pFilters As String = "JPG" _
   , Optional psReturnFilenameOnly As String _
   ) As String
'Requires reference to Microsoft Office #.0 Object Library.
's4p 130325...141204
   ' psPathFile -- if sent, will be parsed for the start directory
   ' psDirectory -- if psPathFile not sent, specifies start directory. default is the FE directory.
   ' psTitle = Titlebar of the dialog box
   ' pFilters -- file extension to browse to, ie: JPG, PDF, XLS*
   ' psReturnFilenameOnly - returns the name of the file stripped from the path if sent
   On Error GoTo Proc_Err
   Dim fDialog As Object 'late binding
'   Dim fDialog As Office.FileDialog 'early binding
   Dim varFile As Variant
   Dim sPathFile As String _
      , sStr As String _
      , nPos As Long
   If Len(psPathFile) > 0 Then
      'get the directory from psPathFile
      nPos = InStrRev(psPathFile, "\")
      If nPos > 0 Then
         psDirectory = Left(psPathFile, nPos)
         sPathFile = CurrentProject.Path & "\"
      End If
      If Len(psDirectory & "") > 0 Then
         'starting directory was specified, psDirectory
         sPathFile = psDirectory
         'psDirectory not specified, use FE directory
         sPathFile = CurrentProject.Path & "\"
      End If
   End If
   With Application.FileDialog(3) 'msoFileDialogFilePicker
      'use pFilter
      .Filters.Add pFilters & " Files" _
               , "*." & pFilters
      'add All files
      .Filters.Add "All Files", "*.*"
      If Len(psTitle) > 0 Then
         sStr = psTitle
         sStr = "Pick a File"
      End If
      .title = sStr
      .InitialFileName = sPathFile
      .AllowMultiSelect = False
      If .Show = True Then
         sPathFile = .SelectedItems(1)
         Exit Function
      End If
   End With 'fDialog

   '-------- set return filename
   psReturnFilenameOnly = ""
   nPos = InStrRev(psPathFile, "\")
   If nPos > 0 Then
      psReturnFilenameOnly = Mid(psPathFile, nPos + 1)
   End If
   GetFile_Browse = sPathFile
   On Error Resume Next
   Set fDialog = Nothing
   Exit Function
   MsgBox Err.Description, , _
        "ERROR " & Err.Number _
        & "   GetFile_Browse"

   Resume Proc_Exit
End Function

Open in new window

John TsioumprisSoftware & Systems EngineerCommented:
If you can "download" the image then you use it with Imagecontrol.Picture or you can store the image as byte array and use PictureData
I have a small sample
Dustin StanleyEntrepreneurAuthor Commented:
Ok Will this Store the image in the database or link to a image outside the database. I truly prefer to link outside to another folder or URL to keep things slim and moving fast. I really appreciate the help. I have tried out several forums in the last month and this one seems to be really good and helpful. I like it a lot.
Firewall Management 201 with Professor Wool

In this whiteboard video, Professor Wool highlights the challenges, benefits and trade-offs of utilizing zero-touch automation for security policy change management. Watch and Learn!

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
If you have URLs stored in the database, you can create a button on the form that with the control holding the URL (ControlSource is field in your table) to open the URL in a browser window using:
   dim sURL as string
   with me.URL_controlname
      if not isnull(.value) then
         sURL = .value
         application.followhyperlink sURL
      end if
   end with

Open in new window

Alternately, a web browser control can be used inside Access but I find that more limiting for scrolling and being able to look at more than one page at a time.
Dustin StanleyEntrepreneurAuthor Commented:
Is the browser window you state as in my browser like IE or chrome or on the form itself?

 I have been able to just state that the URL is a hyperlink and click on it directly and open up a browser in chrome fine. I also have set up a browser control and been able to view it but the images are to large.

 I would like to store maybe the first image in the database directly as a thumbnail image to view like in the photo above and the rest could be on a hyperlink or such. But if someway I could use something like the browser control but be able to fit the image to the Browser control on the form without new links and resizing images on my URLs. That would be best. So the database isn't slowed down by image data.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
the browser would be whatever is set as your default browser.

> "store maybe the first image in the database directly"

just like URLs can be stored, path\filenames can be stored.  It is much better to keep images in external files.  I often create an \images directory below the back-end database (so far, your database is not split into front-end (FE) and back-end (BE)). The BE has tables and the FE has forms, reports, queries, macros, and modules. Each user will have their own copy of the FE once it is split and the database is deployed.
Dustin StanleyEntrepreneurAuthor Commented:
That is what I am working on now is the forms for inserting information. What would be a good command button to capture the link path way for the user on the FE to just click button, browse, choose image.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
best to copy or move the file to an images directory after they browse to it since others who use the database may not have the same path.  I then store images relative to where the back-end is, so I don't actually store the path (usually), just the filename.  An example of how to do that is in my Contacts database when you click the attachments (push-pin) icon here:

Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments
Dustin StanleyEntrepreneurAuthor Commented:
Would i use a image controller to display the image in the form?

Also what about the view larger button that is in my past database software. Is there a way for Access to do that?
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:

yes -- create another form with an image icon that is bigger that can pop up
Dustin StanleyEntrepreneurAuthor Commented:
Thank you I am glad someone came along on that one so when I got there I could do it.  I thought I was abandoned.  ;)
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
you're welcome ~ happy to help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.