insert PNG into OLE field from VB

G

Guest

(Cross-posted from the data import/export group where nobody responded)

(I'm using winXP and MSA XP/Dev)

1st, I want to display a bunch of little bitmaps, (PNGs) in continuous
forms. So the usual trick of storing filepaths and using an unbound image
control at runtime won't work and I HAVE to store them as OLE data, right?

I've read conficting things on the web about this.

One guy sez I have to put the data through an OLE control (on a form) and
gave me code to do that:

Me.LibItemIconOLE.Class = "Bitmap Image"
Me.LibItemIconOLE.OLETypeAllowed = acOLEEmbedded
Me.LibItemIconOLE.SourceDoc = Me.LibItemPNGFilePath
Me.LibItemIconOLE.UpdateOptions = Automatic
Me.LibItemIconOLE.SizeMode = acOLESizeStretch

but that code only seems to effect the CONTROL and not the bound datafield.
(and doesn't put any data in the field at all)

another post sez I should use the "AppendChunk" method but niether the OLE
field or it's bound control seems to allow that.

The closest I've gotten is being able to put "Long Binary Data" into the
..Value of the field, (a BLOB?) but of course that won't display.

to repeat: I'm not convinced I have to store pics in OLE at all if there is
any other to display images in CONTINUOUS FORMs. but I don't think that there
is.

so can someone point me to the right OLE image primer? or tell what I'm
doing wrong

aha tia
roger
 
S

Stephen Lebans

Your code is missing the final and most important step, that is calling the
Action method to complete the process of embedding/linking the object into
the OLE field. Also, I do not know if the Class name for embedded PNG is
"Bitmap Image".
See:
http://support.microsoft.com/kb/198466/en-us
ACC2000: How to Load OLE Objects from a Folder into a Table

--

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

Guest

Thanks Steve!
You and your website have helped me many times in the past.
(and thank you for responding when nobody else would)

I had tried the .Action method, which always failed, and that was because my
Class is NOT "Bitmap Image" but now that I have remarked out the line seting
the calss, and added back the .Action it works fine!

I don't need to set .Class at all it seems.

Thanks Again
 

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