View Full Version : Open OLE object


aikea
08-19-2007, 03:31 PM
I got this program in my project. The "TestFile" is a table with only two fields.

The "ID" field and a "FileName" field which stores OLE object.

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Source = "SELECT * FROM TestFile;"
rs.ActiveConnection = CurrentProject.Connection
rs.CursorType = adOpenDynamic
rs.LockType = adLockReadOnly
rs.Open

rs.Close
Set rs=Nothing

In the program "rs.Fields(1)" would be the OLE object, "rs.Fields(0)" would be the ID column.

Anyone know how could I display it in an unbound object frame?

Surjer
08-20-2007, 06:33 AM
Create a control on your form and then populate it like this... (In my case it was a picture so I had a control Named Sketch...

[Sketch].OLETypeAllowed = acOLEEmbedded
[Sketch].SourceDoc = rs.Fields(1)
[Sketch].Action = acOLECreateEmbed
[Sketch].SizeMode = acOLESizeStretch

aikea
08-20-2007, 08:17 AM
Thank you. Now it works.