Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pasting an image into OLE field

2,199 views
Skip to first unread message

Brian Lewis

unread,
Apr 1, 2001, 3:02:55 AM4/1/01
to
I have a picture on the clipboard, and an OLE (a.k.a. BLOB) field in my
Access database. How can I paste the image from the clipboard into the
field and make Access correctly display it on a form (using a bound
object control)? Alternatively, if I save the image to a file first,
how can I load the contents of the file into the field?

If I can't do this from within Access VBA, can I do it from within VB 6?

So many questions!

Thanks,
Brian Lewis

Simon Lewis

unread,
Apr 1, 2001, 7:18:34 AM4/1/01
to
Hi Brian,

You should be able to paste the image directly, e.g. by right clicking the
bound object control and choosing Paste... is that not working for you? If
it's not, then you might not have a suitable server application installed,
i.e. one that can convert the image to an OLE object.

If you want to do the paste programmatically, the code is
Me.bofImage.Action=acOLEPaste
(where bofImage is the name of the control)

If you save the image to a file, you can load it using:
Me.bofImage.OLETypeAllowed=acOLEEmbedded
Me.bofImage.SourceDoc="C:\MyPics\Pic1.bmp" 'or whatever
Me.bofImage.Action=acOLECreateEmbed

----
Simon Lewis


"Brian Lewis" <br...@jimbabweNOSPAM.com> wrote in message
news:3AC6D29F...@jimbabweNOSPAM.com...

Brian Lewis

unread,
Apr 1, 2001, 3:30:52 PM4/1/01
to
Thanks, Simon. The problem was that I WAS able to paste a single image by
manually pasting into the OLE control, but I couldn't figure out how to do it
in code--I had over 4000 images to loop through, and I didn't want to to each
one by hand!

I ended up saving each picture from the clipboard using VB 6, then doing a
second loop from within my Access form setting the SourceDoc, Class, and
Action=acOLDCreateEmbed on the object for each record. But that's only
because I hadn't found the acOLEPaste action--your way would have been much
faster, and I could have done it entirely within Access!

Thanks again,
Brian

hus...@gmail.com

unread,
Mar 11, 2018, 4:48:02 PM3/11/18
to
Me.myOleObject.SetFocus 'The object where you want the image
On Error Resume Next 'In case it's not an image in the clipboard
DoCmd.RunCommand acCmdPaste 'Does the paste
On Error GoTo 0
0 new messages