Documentation

AccessImagine is ActiveX component to make storing images in various projects as easy as possible. It:
·supports JPEG, BMP, GIF and PNG  file formats
·stores images in JPG format to preserve space
·works with Access and other database applications
·generates previews in JPG and OLE format (for displaying in continuous forms)
AccessImagine design time options
These options are available in property inspector, when you design a form, report or application.
MaxWidth and MaxHeight
If the image exceeds this constrains, it is proportionally scaled down. This applies only when image is saved, preserving full image size for cropping.
StoragePath
If you like not to keep images in database, specify the location for them. In this case bind component to database field that is to hold image file names. Examples of valid pathes:
·“D:\MyWork\Images”
·“\\Avenger\Incoming\Pics” – local network path, useful for centralized storage
·“Pics” – subfolder in folder, where your database file is stored
·“.” – keep images in the same folder with database file
EmptyImage
You can select the appearance of control when it is empty. It can be a Contact sign, Photo sign of simple gray brick (None).
AccessImagine scripting options
Image
Represents picture in control, you can read and write it to manipulate with images.
Changed
Checks if image was changed from the last time this function was called.
PreviewJPG(Size) and PreviewOLE(Size)
These functions generate small previews of image in control. Size specifies the longest side of preview, if omitted it defaults to 64 pixels. If you need to save OLE previews along with your images,  insert this in Exit event procedure of AccessImagine object:
If <AccessImagine>.Changed Then <OLE preview field>.Value = <AccessImagine>.PreviewOLE
LoadFile(filename) and SaveFile(filename)
Use these functions for batch processing and advanced manipulating. SaveFile saves images only in JPG format.

AccessImagine is ActiveX component for storing images in various projects as easy as possible. You need to place it on form while designing your application and bind to some database field.

AccessImagine features:

  • JPEG, BMP, GIF and PNG  file formats support
  • store images in JPEG format to save space
  • get images from TWAIN and WIA devices
  • get images from video sources (including webcams)
  • paste image from any Windows application
  • in-place image croping tool
  • HTTP images display
  • OLE fields support
  • previews in JPEG and OLE formats (for displaying in continuous forms)
  • external image storage
  • on-click big image display

Design time component properties

These options are available in property inspector, when you design a form, report or application.

Background

Specify the control background in hex form (i.e. 00000 is black and FFFFF is white)

Cropping

Cropping type selection:

  • Proportional – cropping tool keeps control’s proportions
  • Normal – crop any proportions
  • Auto – images are automatically cropped to control’s proportions on insertion

EmptyImage

You can select the appearance of control when it is empty. It can be a Contact sign, Photo sign or simple brick (None).

MaxWidth and MaxHeight

If the image exceeds these constrains it will be proportionally scaled down. This applies only when image is saved while preserving full image size for cropping.

StoragePath

In order not to keep images in database you need to specify a location for them. Bind component to database field which holds image file names in this case. Examples of valid locations’ paths:

  • D:\MyWork\Images
  • \\Avenger\Incoming\Pics” – local network path (for centralized storage, etc.)
  • Pics” – a subfolder in the folder, where your database file is stored
  • .” – keep images in the same folder with the database file

If empty.jpg image is present at StoragePath location, it will be used for empty control display

HideButtons

Set this to “Yes” if you don’t want to show the control buttons. It will look just like regular image this way.

OnClick

You can select the control’s behaviour when the user clicks the image.

  • None – do nothing
  • ShowFullPicture – show picture in new window, scaling it down to fit the screeen, if it is too big
  • ShowPanPicture – show picture in new window 1:1 size, giving the ability to pan via a hand tool
  • OpenPictureFile – open picture with the external application, that is associated with JPG filetype

Scripting options

EmptyText

The text shown where there is no image (usually “No Image“). Can be set to empty string.

Image

Represents the picture in the control, both reads and writes are allowed.

ImageBind

Data bound to control (like ControlSource). Use it for late binding or if usual field binding is not available (i.e. at Access 97)

InstantScan (delay)

Makes instant scanner/webcam image capture without user’s assistance. Will wait delay seconds after device initialization before taking image (it may be needed for some cams that adjust focus/brightness at first few seconds).

Changed

Checks if image has been changed since the last invocation of this function.

PreviewJPG(Size) and PreviewOLE(Size)

These functions generate small previews of the image in control. Size specifies the longest side of the preview, if omitted it defaults to 64 pixels. If you need to save OLE previews along with your images,  add the following code to Exit event procedure of the AccessImagine object:

If <AccessImagine>.Changed Then <OLE preview field>.Value = <AccessImagine>.PreviewOLE

LoadFile(filename)

Loads image from file or web (HTTP).  Supports JPEG, BMP, GIF and PNG  file formats.

SaveFile(filename)

Saves image to file.  Supports only JPEG format.

Scanning

Set to 0 to disable Use device button. Set to 1 to activate instant image capture without any dialogs.

TurnRight and TurnLeft

Rotates image 90 degrees clockwise and anti-clockwise.

Copy

Copies current image to clipboard, making it possible to paste image into another application.

Crop X,Y,X1,Y1

Crops the image with the given coordinates rectange.

PicWidth and PicHeight

Return the bitmap image dimensions.

Paste

Inserts image from the clipboard.

Rename(filename)

Rename file in external storage. For that cases, when you need to overcome auto-generated names.

Scan

Aquire image from last used source.

ScanSource

Read/write property, id of image source, where -1 is WIA, -2 is TWAIN, -3 is Microsoft WDM, 0 and up – direct webcams.

SelectSource

Opens source selection dialog.

ShowFullPicture and ShowPanPicture and OpenPictureFile

Perform the corresponding action from OnClick property description.

289 Comments

  1. I’m trying to use ManyCam as image source (works with the Camera app W10). And I’having the following error message “Unknown compression DataSize: 4147200 FourCC: YUY2”

    Is there a way around it?

    Reply
    • Unfortunately, there is no fix.
      But you can use Camera App as image source (with AccessImagine 1.74)

      Reply
  2. I see there is a turn right and turn left property. Can these be added as on picture controls along with the other controls?
    Thanks,
    Rob

    Reply
    • No, but you can create your own buttons on form for rotating.

      Reply
  3. i am trying to use the ExportWithFormatting macro to export a report with AccessImagine images in it as a pdf. The report shows the images fine, but the PDF does not display the images. Is there any way to make this work either through the ExportWithFormatting macro or OutputTo and acFormat VBA? I really appreciate any help you can provide.

    Reply
    • Does the regular PDF export via menu works properly?

      Reply
  4. Is there a way to display and print an image in a report?

    Reply
  5. I am using the control to scan and store images in a SQL table as OLE datatype. But when I scan the images in or import from a file, it shrinks the image to maybe 2/3 the original size. I then put the same control on a report in Access as we want to print the images and it does the same thing. I have tried to play with all the settings in the control and in Access to change this. I tried to resize the control on the form and just get grey or black areas around the image on the screen and printed. Does the control only show small sized images? Anyone else having this issue or any ideas what I need to do different?

    Reply
    • AccessImagine control should be resized properly. Just make sure that you do not drop it in form cell, or it will behave wrong there.

      Place new AccessImagine object somewhere there is nothing on form, then move to desired location.

      Reply
  6. Hello,
    I need to delete picture, paste picture and then start select area for croping, in one click from ms access form.
    Is it possible with the script/ VBA? Please help.
    Thank you.

    Reply
    • HOw to delete picture from VBA script?

      Reply
      • Try this:
        Pic.Image = “”

        Reply
        • Thank you,
          in VBA 2002 it work with this:
          Pic.Image = False

          Reply
          • Is it possible to start selecting image for cropping using VBA?

          • Unfortunately, no.
            But you can crop image via VBA to some coords with Pic.Crop X, Y, X1, Y1

          • Why the control doesn’t show Mouse_Down and Mouse_Up Event? I hope to use it to get X,Y,X1,Y1 Coordinate position.

          • Unfortunately, MS Access supports ActiveX events in very limited way.

          • What is the right input measurement unit for X,Y? ie. Inch, point or pixel?

          • Its pixel

  7. Hello,

    Is there anyway to check if an image control is displaying an empty image when bound to a textbox linking to the storage location?

    Reply
    • I do not have an ability to check and write you the exact code.
      But in general – you can check if Pic.Image property is empty.

      Reply
  8. How do you print a report with the images. The images are in the preview but blank in the PDF or when printed.

    Reply
  9. Hi,

    I was wondering where do you find the ScanSource option under the property sheet?

    Thank You

    Reply
    • It is not in property sheet, its runtime VBA property.
      To select source manually, perform right mouse button click on “Use Device” icon.

      Reply
  10. I really love this program but I have one issue I cannot find a fix for. Can you give an example of where and how the SaveFile(Filename) is to be used? In the control property sheet, which “name” does it want to go before .SaveFile? Data/OLE Class, Data/Class, Other/Name? Instead of it saving as “Scan.jpg” I would like to give it a specific name using VBA (or in one of the Property Sheet areas if that is how it is done). Currently I am using fso.CopyFile for “On Enter’ or “On Lost Focus”, but I need it to always save as a name I give it.
    I am a paid registered user, and I am wondering if this is supposed to go under “Other/Custom” but it show pulls up the AccessImage version window, and maybe that is the issue?

    Reply
    • Nevermind, I just got it to work. I had to remove the entry in the control’s Property Sheet / Other/ StoragePath. Then in VBA I added nameofcontrol.SaveFile(“c:\pictures\test.jpg”)

      Reply
  11. Hi,

    I am using the instantscan function, how do i rename each photo base on a text box in the form?

    At the moment it saving using the default name scan.jpg

    Thank you

    Reply
    • If you have some table field with that text, just bind AccessImagine to it. No need of separate picture field in this case.

      Reply
      • Thank you for your reply, that works :) Another question, how do I stop the file manager or photo editor being called up every time a photo is taken?

        Reply
        • What you mean? Do you have OnClick property set to OpenPictureFile?

          Reply
  12. Hi, i am trying to do a a late binding of the control during runtime to an ado recordset object that has the image date in one field.
    How can i do it?

    Thanks!

    Reply
    • Use ImageBind property (like Pic.ImageBind = … )

      Reply
  13. How would I setup/VBA a form to preview an imagine and after a delay automatically capture the photo?

    Reply
    • That is not possible with AccessImagine.
      You can capture a photo from VBA, but without preview.

      Reply
  14. I have created an Access database and migrate the backend to the sql server to access the db as multiuser. When a picture is added to the front end the following error comes.

    odbc call failed. [odbc driver 13 for sql server] string data, right truncation(#0)

    Reply
    • Check if picture field is of some BLOB type.

      Reply
  15. I’ve been using your control for about three years now and it works fantastic in my application. My DB is run from a network drive and the image storage is in a sub folder on the same drive. What I am experiencing now is extreme save times when dragging and dropping a new image on the control. Sometimes it take upwards of a minute for the file to copy and the image to appear while locking the computer from any other function until it completes it’s task. I know that this is being caused due to the number of images being stored in the folder (roughly 75,000). If I direct the control to a new folder the process of dragging and dropping is lightning fast. Unfortunately due to historical records in the DB and the way the original program was written I cannot change the image path. Is there a way for the control to put the image in the sub folder without it waiting for the 75,000 picture index to load on each drag and drop? Just copy the image without querying the folder itself?

    Reply
    • I think I know what is going on. More likely you have default AccessImagine naming scheme.
      Lets say, AccessImagine tries to save image as «image1.jpg». It checks if filename is taken, if yes – it checks if «image2.jpg» is taken – and this cycle repeats 75000 times in your case.

      You can prepopulate image field with some unique filename for new records. AccessImagine will write image to that filename without checking the folder contents.

      Reply
      • How do I prepopulate the image field with a unique name?

        Reply
        • That turned out not to be as easy as I thought )

          In Form_Current write:
          If IsNull(pic) Then pic = “img” + Right(CStr(DateDiff(“s”, 0, Now())), 7) + “.jpg”

          Reply
  16. I just updated to 1.74 and purchased the developer license so I could use my DB on multiple PCs. Now when I open my forms none of the previous images display in the control is just a white box that I can no longer drag and drop to. How can this be fixed ASAP?

    Reply
    • First of all, make sure that you installed AccessImagine on that PCs.

      Second, maybe you need to enable ActiveX in Access security settings.

      Reply
  17. Thanks Max. It is installed, I’ve been using this OCX for almost 4 years now and everything was working fine until I updated to 1.74. I was able to roll back to 1.73 and everything works again, so it must be a glitch in the 1.75 update.

    Reply
    • Sad to hear that. AccessImagine 1.74 is working really, I have no idea why it acts so for you. Does it gives any error messages?

      Reply
  18. I purchased the licence, tested the program then read the documentation. The first install of you samples worked well where I tested all the features.

    When I added it to my form I get the following error on startup (load event) and on close …

    The expression On Load you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or ActiveX Control.
    * the expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
    * There may have been an error evaluating the function, event, or macro

    How can I fix this and place it on my form?

    Reply
  19. Hello,
    after a few nights spent looking for a solution to my problem, I gave up and I am writing to you for support.
    Using AccessImagine on a continuous mask form, as per your suggestion I used the thumbnails and designed an edit form that opens when you click on the selected thumbnail. Everything works if the form’s data source is a table. On the other hand, if the continuous mask form is based on a query or otherwise filtered, saving the thumbnail from the modification mask causes the error <>.
    Of course, the record or field is not locked as it is saved before opening the edit form.
    Any suggestions are appreciated.

    Reply
    • ….sorry, i’ve used html tags to describe error…….
      here is:

      Could not update; currently locked by another session on this machine. (Error 3188)

      Reply
  20. Hi – I hope you can help – I have a database on SQL Server, everything was working fine with the image bound to the controlsource, though everything was a little slow. To speed things up I from using a bound form to using an ADODB recordset and now the images wont display at all. The images are in the database there as they show if I rebind the data to the form again.

    Its also works if I assign the image using DLookUp().

    A test script below, what am I missing?

    Private Sub Form_Load()
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset

    rs.Open “SELECT * FROM dbo.stock WHERE stockID = 55”, cxnDb, adOpenDynamic, adLockOptimistic
    rs.MoveFirst

    Picture8.Image = rs!StockImage

    rs.Close
    Set rs = Nothing
    End Sub

    Reply

Leave a Reply to Ken Black Cancel reply

Your email address will not be published.