?
Solved

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

Posted on 2009-05-02
14
Medium Priority
?
1,417 Views
Last Modified: 2013-12-25
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.
0
Comment
Question by:Srinivas Mantha
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24287644
>>I wish to have the code in visual basic for access or VB6 to run on my local system.<<
Try www.rentacoder.com
0
 
LVL 39

Expert Comment

by:thenelson
ID: 24388904
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
 

Author Comment

by:Srinivas Mantha
ID: 24389154
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
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
LVL 39

Expert Comment

by:thenelson
ID: 24389340
Yes, there are many image conversion utilities available. I Googled "batch image conversion freeware" and came up with many pages of them.
0
 
LVL 39

Expert Comment

by:thenelson
ID: 24389346
I use PowerDesk - not freeware.
0
 
LVL 27

Expert Comment

by:jjafferr
ID: 24392550
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
 
LVL 39

Expert Comment

by:thenelson
ID: 24396404
Hey Jaffer!

I use irfranview also. Great program. Forgot about its batch conversion capabilities.
0
 

Author Comment

by:Srinivas Mantha
ID: 24400053
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
 
LVL 39

Expert Comment

by:thenelson
ID: 24400271
>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
 
LVL 27

Expert Comment

by:jjafferr
ID: 24401809
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
 

Author Comment

by:Srinivas Mantha
ID: 24404540
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
 
LVL 39

Accepted Solution

by:
thenelson earned 1500 total points
ID: 24404663
Take a look at
http://www.thenelson.name/#LinkedImageDemo
It's all in there.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

850 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