Access 2013 - Image Field - Double Click to enlarge and edit

Access 2013 Database

I have a form that assigns a picture to an image field and I'd like to be  able to double click the image field and see an enlarged copy of the photo and then when I close have the option to save the image with any edits I might make

Is this possible? If so please help me get started with the process

Who is Participating?
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPConnect With a Mentor Commented:
Here is the code I use for ShellExec

I would place this code in a standard code module named something like modShellExec.
Option Compare Database
Option Explicit

Public Const SW_HIDE = 0
Public Const SW_NORMAL = 1
Public Const SW_SHOWNORMAL = 1
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWNA = 8
Public Const SW_RESTORE = 9
Public Const SW_MAX = 10
Public Const SW_SHOWDEFAULT = 10

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Function bimShellOpenFile(strFilePath As String, lngShowCmd As Long) As Long
' opens the file passed by calling windows
' the file should be opened into the app associated with the files type

Dim r As Long
Dim hwnd As Long

r = ShellExecute(hwnd, "open", strFilePath, "", "", lngShowCmd)

bimShellOpenFile = r

End Function

Open in new window

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
Is this possible?
Maybe ...

What image editor software will you be using?  Does it support automation?

*** Note: Every computer that will run your database and need to edit images will have to have the image editing software installed.

What is built-in

Edit images from within Access

If the computer that runs your database has the graphics program used to create your images, and that graphics program supports being started from within Access, you can edit images directly from your form. If you aren't sure whether your graphics program supports that functionality, the best way to find out is to follow the steps in these sections and try to edit a bound or unbound image.

 Note   If you're editing embedded images, these steps only change one instance of the image. These steps do not change the original image. Also, if you embed an image more than once, you must change each instance of the embedded file.

Custom Solutions

You could write custom VBA code to do it if your have an image editor that supports automation.

1) write the image out to a (temp) file
2) launch the editor
3) check to see if the file have changed
4) If changed then:
- 4a) delete the original image
- 4b) insert the updated image
5) delete the temp images.

There are third-party controls you can purchase that will do this.

Check out:

1) GdPicture

GdPicture.NET series of toolkits and plugins provide both .NET and ActiveX controls so , besides .NET platforms, you can use it in many other different platforms such as HTML page, SilverLight app., Visual FoxPro, Delphi, VB6, MSAccess and all other IDE supporting ActiveX.

Main Features

    Resize and Scale an image using nine different interpolation algorithms.
    Create HQ thumbnails.
    Image filters include Per Pixel Filters, Convulsion Filters, Edge Detection Filters, Bilinear Filters and Displacement Filters.
    Effects and Filters include Median, Gaussian,Unsharp Mask, Despeckle, FloodFill, Red-eye removal, Emboss, Sharpen, Blur, Edge Detection,Twirl, Chroma Key Background Removal…
    Color anti-aliasing and smoothing.
    Scale a bitonal bitmap to a gray bitmap.
    Advanced image-merging support.
    Area and region processing.
    Standard rotations: 90°, 180°, 270°.
    Mirror, flip and invert an image.
    Angle rotation with 1/1000 degree increments.
    Adjust contrast, brightness, gamma and saturation.
    Bitonal Image Enhancement: repair characters, remove lines and fill holes.

2) DBPix - The Image Control for Microsoft® Access
Add images to Access databases, easily and efficiently with DBPix, the High-Performance Image Control for Access.

3) AccessImagine ActiveX
browse and load, drag-n-drop, paste from clipboard, aquire from scanner or web-cam images right to database, in-place cropping tool, undo, old OLE data support, display HTTP (web) images, JPEG, BMP, GIF and PNG  file formats support, store images in JPEG format to save space, external image storage with automatic maintaince, anti-aliased image display, automatic resampling, continuous forms solution, on-click full-screen image display fitted to screen or with panning tool, opens image on-click in editing application, 90 degrees image rotating, VBA scripting image manipulations, SQL Servers and .NET languages support, x64.

What I find works best:

Do not store the images in the database. Only store the path to the file.

To edit the file I use ShellExec to open the file in the default image editor. You could use Sell to specific the program and file path.

That is it. That easy. The key is the changes must be saved back to the original file name.
rogerdjrAuthor Commented:
I use microsoft windows 8 paint version 6.3 as my default photo editor - but I would be fine with opening the photo in acrobat or some other "basic" photo viewer.

As you suggested I store the file & path in the database not the photo.

How would I "To edit the file I use ShellExec to open the file in the default image editor. You could use Sell to specific the program and file path. "
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

rogerdjrAuthor Commented:
Thanks for the help - end result was:

Function OpenImage(sFilePathAndName As String)
       On Error GoTo Error_Handler

       Shell Chr(34) & "C:\Windows\System32\mspaint.exe" & Chr(34) & " " & Chr(34) & sFilePathAndName & Chr(34), 1

       If Err.Number = 0 Then Exit Function

    MsgBox "MS Access has generated the following error" & vbCrLf & vbCrLf & "Error Number: " & Err.Number & vbCrLf & "Error Source: OpenImage" & vbCrLf & "Error Description: " & Err.Description, vbCritical, "An Error has Occured!"
   Exit Function
End Function
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
Thanks for the update and points.

I would also add a test to see if the file exists before executing the Shell().

Function OpenImage(sFilePathAndName As String)
       On Error GoTo Error_Handler

       ' Test to be sure the file exists before opening
       If Len(Dir(sFilePathAndName )) < 0 then 
            MsgBox "File not found!"
            Exit Function
       End If

       Shell Chr(34) & "C:\Windows\System32\mspaint.exe" & Chr(34) & " " & Chr(34) & sFilePathAndName & Chr(34), 1

       If Err.Number = 0 Then Exit Function

    MsgBox "MS Access has generated the following error" & vbCrLf & vbCrLf & "Error Number: " & Err.Number & vbCrLf & "Error Source: OpenImage" & vbCrLf & "Error Description: " & Err.Description, vbCritical, "An Error has Occured!"
   Exit Function
End Function 

Open in new window

rogerdjrAuthor Commented:
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.