How do I insert into a OLE Odject Type field at runtime

G

Guest

I have a table with one OLE Object type field. I need to store a BMP image to
this field at runtime via a query (i.e. not the "insert object" dialouge at
design time). I am battling to find sample coe for this. Can anyone please
assist?

Thanks
 
W

Warren

This is from Access Help

---------------------------------------------------------------------
OLE Object Properties Example

The following example creates a linked OLE object using an unbound
object frame named OLE1 and sizes the control to display the object's
entire contents when the user clicks a command button.

Sub Command1_Click
OLE1.Class = "Excel.Sheet" ' Set class name.
' Specify type of object.
OLE1.OLETypeAllowed = acOLELinked
' Specify source file.
OLE1.SourceDoc = "C:\Excel\Oletext.xls"
' Specify data to create link to.
OLE1.SourceItem = "R1C1:R5C5"
' Create linked object.
OLE1.Action = acOLECreateLink
' Adjust control size.
OLE1.SizeMode = acOLESizeZoom
End Sub
---------------------------------------------------------------------------------------

I would use:

Private Sub YourButton_Click
OLE1.OLETypeAllowed = acOLELinked
OLE1.SourceDoc = "C:\YourPic.BMP"
OLE1.Action = acOLECreateLink
End Sub

Done!
 

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