Solved

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

Posted on 2013-12-06
6
1,950 Views
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

Thanks
0
Comment
Question by:rogerdjr
  • 3
  • 3
6 Comments
 
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

See: http://office.microsoft.com/en-us/access-help/use-images-in-your-access-forms-reports-and-controls-HA001147204.aspx#BMupdatelinks
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.

Steps:
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

http://www.gdpicture.com/solutions/Image-Processing.php

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

http://www.ammara.com/index.html
Add images to Access databases, easily and efficiently with DBPix, the High-Performance Image Control for Access.

3) AccessImagine ActiveX

http://access.bukrek.net/
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.
0
 

Author Comment

by:rogerdjr
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. "
0
 
LVL 21

Accepted Solution

by:
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_SHOWMINIMIZED = 2
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWMINNOACTIVE = 7
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

0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Closing Comment

by:rogerdjr
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

   Error_Handler:
    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
0
 
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().

Example:
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

   Error_Handler:
    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

0
 

Author Comment

by:rogerdjr
ID: 39715087
Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
This article will show you how to use shortcut menus in the Access run-time environment.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now