Save a picture in the database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

(I've posted this thead once in Modulesdaovba but I haven't received any reply)
Hi,

I know that it is better to save a link to a picture than saving the picture
in the database.
But how to save a picture in an OLE object in the database through VBA?

Any Help is very appreciated.
Thanks
jouj
 
I never save pictures to a database because of bloat and increased risk of
corruption, but the way to do it is to use the OLEClass property to set the
type to Paintbrush Picture, then the OLETypeAllowed property to specify
whether it's linked or embedded, then the SourceDoc property to set the path
to the object.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Hi,
Thanks for you reply.
I have a table Table1 of 2 fields ( f1: text, F2: OLE Object)

I wrote this Code in a form (Bounded to Table1:
1 Me.f1 = "A"
2 Me.f2.OLEClass = "Paintbrush Picture"
3 Me.f2.OLETypeAllowed = acOLEEmbedded
4 Me.f2.SourceDoc = "C:\Picture2.jpg"

NOTHING.
the property .OLEClass for a Bound OLE OBject does not exist
and the .Class one does not do the Job.
2 Me.f2.OLEClass = "Paintbrush Picture"

and the .OLEClass for an Unbound OLE Object raised an error: Read Only
Property

What am I Missing??
Thanks again
jouj
 
jouj said:
(I've posted this thead once in Modulesdaovba but I haven't received any
reply)
Hi,

I know that it is better to save a link to a picture than saving the
picture
in the database.
But how to save a picture in an OLE object in the database through VBA?

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.

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