Question Attaching images to a database.

Raymas

Registered User.
Local time
Today, 20:23
Joined
Mar 8, 2011
Messages
21
Hi All,

I am just wondering what is the best way to attach images to a database? I more asking for people's opinions and experiences. I have looked around and have not being able to come to a definitive conclusion.

I am weighing between emedding images, which I fear could become an issue with space, or attaching links to the image locations, which could be a problem if the the database or images are moved.

I am creating a product database that stores all of the companies products and raw materials, among other data. We wish to attach a picture/s to every product and maybe even everyraw material. There could be up to 1000 products and just as many raw materials. The images will be visible when viewing a particular product and material in a form and in reports. So if you have any thoughts or opinions based on experience, feel free to comment.

Cheers,

Raymas
 
If you use an image file that is in the same location as your DB file, and simply store the image name in your DB you can use the following to return the file path for the image;
Code:
Application.CurrentProject.path & "\Image File\" & [ImageName]
 
There is a small sample demonstrating this here.
 
Thanks for your reply John. That seems like a very simple method, I like it! However, I want to make it as simple as possible for the user of the system. Is there a way similar to your method that allows the user to input the location, with a similar pop-up like you would say if you were opening a file in any office application?
 
Cheers dude.. that looks really good! Now i'll just have to get my head around all that code. Almost home time here, so i'll jump into it tomorrow.
 
Hi John,
I've had a look through the code this morning, and I understand it enough to make my own version for my database. Just one thing.. I'm guessing this was created in an older version of Access, am I right? On my PC I am using 2007, but my company is using 2010 at the sight I am working from. So I am wondering is it wise to be programming with out dated techniques, or is this method still pretty relevant? I guess the other advantage of using this method is it would be backwards compatible, as we do have sights in other countries (not sure what versions they are running). But if you know if there is a better method for '07/'10 let me know.
Cheers,
Raymas
 
I beleive that the sample was written for Access 2K.

It's been a while since I've had a play with it. I'm guessing that you should be able to use the code as a template and update it to operate in '07 and '10, the basic structure should still be valid, but some of the commands may need to be updated.

I currently don't have access to '07 and have no access to '10 so I'm afraid I can't really add any advise beyound that.
 
No worries. Yeah well the sample you sent me still works in 2010, so I think most of the commands (if not all) are still valid. But yeah I can still have a play. Thanks for your help, certainly made my life a lot easier. I did find the original sample code from microsoft based on this method, and it was last updated in 2004, so yeah it could have taken me a while to find. And I compared the file sizes for directly attaching the photos to the database, and it was 50MB for 2 dozen photos, compared to 1.5MB without (after I discovered the "Compact and Repair Database" feature) which I was pretty surprised by considering how big my database is.
Anyway thanks again.
Raymas
 
Earlier versions of Access translated these images into bit maps so every bit is mapped. Bloatware or Objects as Large as Elephants.

Simon
 

Users who are viewing this thread

Back
Top Bottom