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
 
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