VB code: saving BMP images stored in OLE data type in MS access to JPG format in a folder

I have microsoft access table containing BMP images stored in OLE data type . I wish to write a visual basic code to save the images in JPG format in a particular folder.  Each JPG file should be named by unique ID that identifies each record in the table and suffixed by a letter that describes image category. For example, the MS access table 4 fields. Application number that uniquely identifies a record and 3 OLE datatype fields each for photograph, signature, and thumb impression. First record has application number as 1001, and second as 1002 and so on.  The 3 JPG images for each record in a folder should be saved and named in such a way that photograph should be named as 1001p.jpg, signature as 1001s.jpg and thumb impression as 1001t.jpg.  The JPG Images for second record should be saved as 1002p.jgp, 1002s.jpg and 1002t.jpg. So on for all the records in the table.  The idea is to upload the entire folder to web and write asp code for displaying images on the web.  I wish to have the code in visual basic for access or VB6 to run on my local system.
Srinivas ManthaConsultant Anesthesiologist and Pain PhysicianAsked:
Who is Participating?
 
thenelsonConnect With a Mentor Commented:
Take a look at
http://www.thenelson.name/#LinkedImageDemo
It's all in there.
0
 
Anthony PerkinsCommented:
>>I wish to have the code in visual basic for access or VB6 to run on my local system.<<
Try www.rentacoder.com
0
 
thenelsonCommented:
Not easy to do. Microsoft has kept the inner workings of OLE secrete. Lebans has reversed engineered OLE. Take u look at this:
http://www.lebans.com/oletodisk.htm

Good Luck!
Nelson
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
Srinivas ManthaConsultant Anesthesiologist and Pain PhysicianAuthor Commented:
Let us say that bmp images are in a folder rather than in embeded OLE in MS access database.  Is it possible to convert all the images in jpeg format with a code.  Idea is to save time and make it error free conversion especially with regard to file names.
Thanks
Srinivas Mantha
0
 
thenelsonCommented:
Yes, there are many image conversion utilities available. I Googled "batch image conversion freeware" and came up with many pages of them.
0
 
thenelsonCommented:
I use PowerDesk - not freeware.
0
 
jjafferrCommented:
Hey Nelson buddy, smanthanims

I use iview from www.irfanview.com
this is one of the best image viewing/converting program, freeware too.

you can either do the conversion from the program directly through it's batch process, or can be controlled from the command line, which you can use with VB.

I have been using it for more than 10 years already :)

jaffer
0
 
thenelsonCommented:
Hey Jaffer!

I use irfranview also. Great program. Forgot about its batch conversion capabilities.
0
 
Srinivas ManthaConsultant Anesthesiologist and Pain PhysicianAuthor Commented:
Thank you Thenelson.  Irfanview is wonderful and doing the required job including batch conversion.  Going back to original problem, If i have several BMP images in a folder named with a 9-digit unique ID followed by suffix (p or s or t) indicating the nature of image (photograph, signature, thumb impression respectively), is it possible with a VB code (Access VB code or standard VB6) to insert them as embeded OLE objects  (not long binary) in different records in MS access database?
Thanks
SM
0
 
thenelsonCommented:
>Thank you Thenelson.  Irfanview is wonderful <
That was Jaffer's suggestion.

So you want to store the images in OLE objects? I understood your original question was to extract the images from OLE objects.

Think 5-6 times before you store images in OLE objects.  Read the following info about accessing images in Access especially the paragraph about storing images in OLE objects.

Here are two sample databases for storing images.  

This one links to images stored outside of the database which is preferred to the second method because Access is not good at storing images within it:
http://www.thenelson.name/#LinkedImageDemo

This one stores the images within Access as OLE objects.  
http://www.thenelson.name/#ImbededImageDemo
It is ok to do this for very small images such as icons but will rapidly bloat the database to unusable size if used for larger images.  Here is a link of someone who is trying to fix a database that has bloated with Word and Excel OLE objects: http://www.experts-exchange.com/Databases/MS_Access/Q_21538911.html.

Here is another reference for storing images within Access as Blobs. Does not create bloat.
http://support.microsoft.com/default.aspx?scid=kb;en-us;103257#appliesto

And here are articles about the comparable merits of the three different image storage methods.
http://www.jamiessoftware.tk/articles/handlingimages.html
http://www.granite.ab.ca/access/imagehandling.htm
0
 
jjafferrCommented:
Like Nelson said, go with Linked images, that is the correct approach and the lightest on Access,
Blobs are another good way, where you have to extract the file (an image in your case) with code to a directory, then use the Link the images, as the 1st option.

once you have an image, you can with code link it to "any" othe place in the Database.

But don't go with embeded images.

Hmmmm, did I say anything new????
Nelson have said it all :)

jaffer
0
 
Srinivas ManthaConsultant Anesthesiologist and Pain PhysicianAuthor Commented:
What is the code to link the images to an access database assuming all the images are stored in a particular folder named by 9 digit unique ID suffixed with a letter to denote the nature of the image.  For example,
191300001p.bmp
191300001s.bmp
191300001t.bmp
191300002p.bmp
191300002s.bmp
191300002t.bmp
191300003p.bmp
191300003s.bmp
191300003t.bmp
191300004p.bmp
191300004s.bmp
191300004t.bmp
and so on
Let the access database have table (tblimages) with 4 fields, one number (long integer type) to store the unique id and three fields OLE object fields to store the linked images
Thanks
SM
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.