Store linked file in blob field

R

Rühmann, Günther

Hi together ,



i have a Microsoft Access application where users stored linked files
instead of the file contents in sql server blob fields. Now I need to move
the file content programmatically from disk file system into the blob field.



With help of this news group I have some code to get the filenames and paths
where they can be found in file system.

But how can I write the file into the blob field so that the access
application recognizes in a form with ole control that athe content of a
blob field is a jpg file so that after doubleclicking that control the file
is opened in photo editor or some other image application.



Thanks



Guenther
 
S

Stephen Lebans

Do you really need to insert the Images as OLE objects? Are you aware of the
data bloating that occurs? THe Image ends up being stored in an uncompressed
format, as many as three complete times within the OLE field.
See:
http://support.microsoft.com/kb/114214/en-us
ACC2: How to Programmatically Embed or Link an Object in a Form

The preferred method is to use the standard Image control and link the iamge
to the Picture property at runtime. See:
http://support.microsoft.com/kb/210100/
How to display an image from a folder in a form or in a report in Access
2000
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
L

Larry Linson

But how can I write the file into the blob field so that the access
application recognizes in a form with ole control that athe content of a
blob field is a jpg file so that after doubleclicking that control the
file is opened in photo editor or some other image application.

If you truly mean Binary Large OBject when you say "BLOB" rather than
storing the file as a true OLE Object, you cannot do what you want, because
a Bound OLE Frame can only handle OLE Objects. But, you can store your
binary file in an OLE Field as a Binary Large OBject, retrieve it, and
display it in an Image Control, as described and illustrated in the
referenced, linked item below.

The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

NOTE that Access 2007 has eliminated the problem of database bloat with OLE
Objects, but not some of the other drawbacks of that method of storing the
images -- you are still "at the mercy" of whatever software the user has
registered for the file type.

NOTE also that the sample application does not show two additional methods
of handling images. The image disk address or hyperlink to a website can be
stored in a hyperlink Field, or stored as text in a Text Field, and used
with the Application.FollowHyperlink statement. These, also, "leave you at
the mercy" of the software registered for the file type. They are excellent
approaches to handling Word, Excel, or PowerPoint documents on systems in
which Word, Excel, or PowerPoint software is installed, but not necessarily
the best for images.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zip is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top