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

Posted on 2013-12-06
Last Modified: 2013-12-12
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

Question by:rogerdjr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 21
ID: 39702822
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.

Author Comment

ID: 39703237
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. "
LVL 21

Accepted Solution

Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
ID: 39703570
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)


Author Closing Comment

ID: 39713359
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
LVL 21
ID: 39714454
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


Author Comment

ID: 39715087

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question