They say its better not to put images to database. Maybe its rumors, maybe not. Anyway, large amount of images makes DB fat and thus stresses database application. Its not easy to handle fat beings, huh.
Thanks to AccessImagine, all you need to specify is where to keep images – and it will do all the job by itself. If you try to code external storage by your own, you will have hard times. Not worth getting in trouble with.
There is StoragePath property accessible at the design-time. After specifying it AccessImagine will store images there while image filenames will be written to the bound database field.
Here is an example of the StoragePath property values:
- “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
AccessImagine tries to preserve original name of the picture – or gives some common name (like “image”, “scan”, “paste”) if it originated from the other source. Surely, component adds some numbers for duplicate filenames.
Notice: if a file is no longer needed (i. e. user put a new photo instead the old one) it will be deleted from the storage.
I have a db that I store all the locations of my images. I want to load the control with a image. Can I do that in code? If so what is the format. I tried .value but it did not work
You can use LoadFile method like this:
Pic.LoadFile “c:\pics\house.jpg”
I would like to store images externally, but I cannot see the property inspector to do this.
In order to show property inspector you need to press right mouse button on some object and select “Properties” in menu.
Is this feature available in all versions?
Property inspector is regular Access asset, where you set different properties of the object – name, coords & so on.
You can see it on 4th slide here – http://access.bukrek.net/tutorial/starting
I am getting an error when trying to add a picture: “Data binding error: when the StoragePath is set, control must be bound to string type field, not the OLE/IMAGE/BLOB one.” I have the image bound to the “Picture” OLE as shown in the demo. If I leave the Storage Path out the properties the original location appears to be stored in the database as the images always come up, but if I wanted them copied I have this error.
So far I like everything about the program and will probably be purchasing soon!
When the StoragePath is empty, images are saved to database, and control have to be bound to OLE field.
When the StoragePath is set to some location (like “c:\pix”, “\\zeon\pics”), AccessImagine control have to be bound to the text field, where the filename of the picture will be saved.
I need to use an unbound form because I am encrypting the data base on a field basis.
Is there any way of obtaining the filename of the image programatically so that the filename can be stored in a recordset object field?
Yep, try using Pic.Value
Hello again!
I changed my field to Text, but whenever I try to do the StoragePath and add the photo in, an error message pops up saying “The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.”
What did I miss or get wrong this time??
Thats strange a bit. Try to delete AccessImagine object and create it again.
If this doesn’t help, please send your database at access@bukrek.net for me to check.
I do not know what I did differently, but it is working now after do that! Thank you for your patience!!
Can I set the StoragePath property programatically with VBA? Like when I open the form containing the AccessImagine object with code “Me.slide_image.storage_path = cnst_Path”.
Sure, its even easier with VBA. In your case it will be
slideimage.StoragePath = cnstPath
“Pics” – subfolder in folder, where your database file is stored.
I created such an order in the path of my Database, but when I try to write “Pics” in the StoragePath, I get an error message.
I want to use only a relative path to my pictures. How can I do it?
Sometime it happens, if you open your database in special way. Try to open your database file with Open… option in MS Access, and check if StoragePath works correctly this way.
Is there anyway to fix this as it works when you use the file open method but does not work if you double click on the database to open it, which is what most people will do. Thanks!
Sorry for reply delay.
You should add this code to database initialization:
ChDrive (CurrentProject.Path)
ChDir (CurrentProject.Path)
Thanks for your reply. Unfortunately, for some reason this did not seem to work for me. Thanks for trying.
This code works, it is tested.
Maybe you have your DB at network path, or inserted into wrong section. Make sure it is really executed.
Max,
I am testing your program and so far it is working well. I have to store the images on a server and the path is working properly. However I have two issues:
1. I need to set the image name to a student ID (i.e. P00012345.jpg)
2. I am using InPhoto ID SLR for the TWAIN capture and it looks like AccessImagine is overriding the setting, can I control this?
Hi, Mike!
There is no way to control the image naming for now. If you need this badly, you can perform the manual rename with the “if Pic.Changed then…” in “On Exit” event handler of AccessImagine object.
AccessImagine uses default TWAIN driver, but the Windows logic is strange here.
Thank you for the response.
Using this “if Pic.Changed then…” — are you saying this will rename the file on the external location?
I’m not getting the Save(FileName) method to work. The code below simply saves a second copy of the image file under the new name, while the records contains the link to a first copy which was saved under the original name.
==========================
If ctlPic.Changed Then
ctlPic.SaveFile (strFilePath & “\” & strFileName)
End If
=======================
Hi!
You don’t need to save picture by hand, its saved automatically while being changed.
“Save” method is for situations, when you want to save image somewhere (for export or something like that).
Hi. Just add a text field, give it a name, I.E. location, and in the field’s name put the name you want to assign, that’s all.
Hello,
i can’t find StoragePath in the OleBound control properties in access 2003
You should press Insert ActiveX and select AccessImagine there.
Regular OLE controls are not changed.
Hi! I am trying to get the AcitveX to save the pics in a folder directory with the pics named a specific way. How can I do that?
AccessImagine names image files automatically (and tries to retain original filename).
If you want to give image file some special filename, you can use VBA command Pic.rename(“mypic.jpg”)
Ok, under what procedure would I put the Pic.rename? Under Pic_updated or Pic_Exit?
Pic_Exit
Access doesn’t recognies Pic_updated for some reason.
Thank you so much for all of your quick replies Max!
The pictures are still naming themselves scan3, scan4, etc. This is my code, what am I still doing wrong?
Private Sub Pic_Exit(Cancel As Integer)
Pic.Rename ([ID] & “.jpg”)
End Sub
I’ve tested it right now and discovered .Rename procedure to be quite buggy.
At this moment I am at vacations. This will be fixed approximatly in a week.
Ok thank you so much Max!
I love your product and will purchase it as soon as I can get it set up the way I need!
Hi Max!! Any progress on this? I am anxious to use your control! :)
Hello!
I’ve got stuck at Bulgaria because my car got broken and I wait for it’s repair.
I hope I will get to motherland in a week or so.
Okay thank you Max!
Hi Max! Is your car fixed?
Hi!
Just got to home yesterday at last ))
Wait for update soon.
Yay!!
Should I try downloading it again?
Did this ever get resolved? I’m interested in the solution.
Pic.rename not working.
Has this issue been resolved!!
Pic.rename is not a nice solution.
Its recommended to bind AccessImagine to the field, that will be the source of filenames (i.e. ID field) – if you want specific filenames.
I still require some help with the renaming of the picture file. I’ve read through the previous comments and tried some different things to no avail. What is the solution here?
Real scripted picture files renaming is not easy and have some drawbacks.
If you want to name your files with the name of some field contents (like ID), just bind AccessImagine object to it.
Wondering if possible to save images to a FTP folder for access online web?
Nope, AccessImagine do not have built-in FTP. You can save images at network share or some folder that synchronizes with FTP via some software.
Hi Max-
After I crop photos on my subform, they don’t show up in the original directory. I haven’t set any storagePath so I’d expect them to show up.
Any idea what could be happening?
If you not set StoragePath, pictures are stored inside database.
As you expect them to be in directory, you need to set StoragePath for every AccessImagine object.
Problems set by vba StoragePath
Private Sub Form_Open (Cancel As Integer)
Picture0.StoragePath = cnstPath
end Sub
(‘the constant value cnspath = c: \ photos)
to set the StoragePath by the system accuses a vba runtime error (-2147418113 (8000ffff)
can not open file “c: \ empty.jpg.” The system can not find the file specified
Option END or debug clicking finalize END closes the form,
Defining the StoragePath control property it works normal, but must set via vba
help me please
PS sorry for the bad english I am Brazilian and I’m with the help of google translator kkkk
Is it possible to set the storagepath with code or use a variable? I wanted to use this with an application I’m developing and allow the end-user to choose where they will store the photos.
Yep, you can set StoragePath property with VBA. Use Form Open event for that.
Oh I see now, as Eder said in the earlier post, I can set the folder path in the onload event of the form. Thanks Eder.
I’m getting the same error as Eder above using Form_Open:
(-2147418113 (8000ffff) can not open file “c: \ empty.jpg
When I add the jpg file to the folder path, the error code stays the same but the text changes to “Bitmap image is not valid”
What am I doing wrong?
nevermind – I figured this out based on the feedback in the thread on the other support page.
Adding the “On Error Resume Next” to the beginning and the “form.requery” to the end worked.
Thank you.
Can someone please provide a bit more information about how to set the StoragePath using VB. I want my users to be able to input their own path.
Just set it as usual property:
Pic.StoragePath = …
When linking pictures with the StoragePath function,is it possible to have multiple pictures in a single ActiveX object, like you can when using embedded pics via attachment?
Nope, you can hold only one picture in one field.
Thanks for the quick response. AccessImagine is a fantastic tool–I am amazed Access does not have all the functionality this provides.
I see the line in properties for having nothing appear in the photo box if there is no photo, and for setting the background color for when there is no photo or if an uncropped photo does not fill up the entire box–is there a way to make the “no photo” area transparent? I want to use both horizontally and vertically oriented photos in the same field box without the vertical ones having a big gray box when I’m using a background image for my form.
Thank you!
Unfortunately, ActiveX controls can’t be transparent or have transparent areas.
Is there a zoom feature?
Yep, there are several modes of showing image on click.
Change OnClick design-time property to activate them.
hi friends we i have stored pictures on the server and then i have load the pictures on pic2 as “\\Avenger\Incoming\Pics\1.jpg” but the problem is when my system don’t find the 1.jpg then it give me the message but i would like the pic2 not to show the message that can’t find the 1.jpg thankx
It shouldn’t show any message.
Are you using VBA to load image?
Hi Max,
thx for this great ActiveX. I implemented it using external files, all works fine. The only thing is: Deleting a pic is too easy. Pressing the dust bin button and the file is whiped from the file system. That’s a bit to fast for me (and many of my customers).
Is there a way to either hide the delete-button (like the scan buttn) or implement a “please confirm requery” before the delete is done?
Many thx in advance,
Nope. But deletion can be undone by Undo button.
Love the product Max! Is there a way to dynamically update the StoragePath property so that different users can externally save photos to Dropbox which has a user-based directory pathway (C:\Users\NAME\Dropbox)? I was thinking that the user could log in to security for the Access application using their name and this value would update the pathway saved in StoragePath so that all users end up with the same pathway for a particular project. Thanks!
Thank you!
Yep, you can write the StoragePath via VBA. But I am not sure about proper event handler where to do this – StoragePath should be formed BEFORE the picture loading occurs.
Hi there, I am trying to add a VBA event to my AccessImagine control to set a path but I do not see an option for Storagepath in VBA.
I believe it should look something like this me.AddSigFile.StoragePath = “pathLocation”
After the period for AddSigFile I do not see StoragePath in the dropdown menu.
AddSigFile is the name of the ActiveX Control.
Thanks!!
You are writing it correct.
Access do not show hints in dropdown menu for ActiveX.
Just make sure that you set StoragePath BEFORE image is loaded.
I am using AWS RDS SQL Server as back end for my MS Access project.
Can I store images IN the database in this situation?
1. Since it is RDS, I can not setup a file share.
Is S3 a possible solution?
Thanks in advance!
Yep, you can store images in DB in your case.
I should have tried first; Using AI, it was unbelievably easy and quick. I think it took longer to download and install than to add the new object to my form.
Where are the images captured with the webcam stored? I can’t understand how to specify where to store images
click the activex object (your picture control), check properties, All. Scroll to bottom and find StoragePath.
if blank, will store in your database
I have successful stored images on an AWS RDS sql server database.
Now, I want to use an UNC share (which is on windows server 2012, and is local in C:\temp\SecuredImages).
Before I bound the control class to a text field, I got the error that is documented on your site.
I added the text fields to hold the path (varchar(255)).
I added a new accessimage object to my forms tab, changed the control class to the text field and tried but the unc path and C:\temp\SecuredImages. (StoragePath).
No error, but my image does not appear in the application.
Access 2016 running on Windows Server 2012.
I have activated the activex, but now when I double click the control, I am not prompted with license (disabled now that it is activated???)
Help!
Thanks
Rob
Update: When I try same thing on my desktop (windows 10), and store on my local C: drive, it works as expected.
Could there be a problem with Access 2016 on Windows Server 2012? If so, why would it work saving to SQL Server?
Ignore this…
for some reason, my form was in readonly. Access was unhappy.
when I tried to edit another field, I noticed the teeny, tiny message in the bottom left of the form that stated can not update recordset..something along those lines.
Phew!
What happens when more than 1 record saves an image with the same name, and since its the same picture object, the external storage location is the same?
Can Access Imagine run using an iPhone as the camera?
We tried EpocCam and IvCam and it lists them in the drop down but does not capture the picture from them. Is there a way?
Unfortunately, I do not have answer for this question.
You need to try different ways. Press right mouse button at “Use Device” icon to select different sources.
I have an Access application with a MySQL database backend.
I have placed an AccessImagine control on a form and linked it to the MySQL data table. If I manually select an image using the control it is successfully saved to the data table. But I need to save an image imported from Excel using VBA script. This does not seem to work.
I have searched your online support and the internet but cannot find a solution. I found some articles on the internet that state an image cannot be saved in MySQL with AccessImagine using VBA script.
What is an “acceptable” delay time from the time you click to take the picture, to the time it displays.
I have two variables set up, temppath, and filename.
temppath = “c:\temp\”
filename = “image.jpg”
I have the following code:
AccImg.InstantScan (1)
AccImg.SaveFile (temppath & filename)
This works, but takes about 3 seconds for the image to show.
I have some code that builds the path and file name, but for testing everything was rem’d out beyond what is above. The actual image seems to be captured about 1-2 seconds after the click, but it doesnt show for another second or 2.
Hi, I don’t understand how/where to set the StoragePath
I’m trying to group photos in to folders which are named using an ID field. Reading the comments here, I can see that it is possible using VBA, but I can’t understand how to implement this. Can you explain how to set the StoragePath using VBA?
An example of what I’m trying to achieve:
C:\path\to\database\ID\xx.jpg
Set StoragePath to C:\path\to\database\ID via VBA.
Bind AccessImagine object to the field, that holds the “xx”.