Reference an OLE object in a field / recordset. (1 Viewer)

sdawilson

New member
Local time
Today, 12:29
Joined
Feb 20, 2022
Messages
6
Evening all,

I can't find the right way to reference an object embedded within a field.

Here's my code:

Dim RS As DAO.Recordset
Dim XL As Object

Set RS = CurrentDb.OpenRecordset("SELECT * FROM [Excel_Workbooks]", dbOpenDynaset, dbSeeChanges)

Set XL = RS![Workbook]
...


I can't see how to fix this... any ideas?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:29
Joined
Oct 29, 2018
Messages
21,358
Hi. Welcome to AWF!

Is it an OLE or Attachment field?
 

sdawilson

New member
Local time
Today, 12:29
Joined
Feb 20, 2022
Messages
6
Thanks... It's an embedded excel workbook.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:29
Joined
Oct 29, 2018
Messages
21,358
Thanks... It's an embedded excel workbook.
I think you can embed and Excel workbook either way. Do you know how you embedded it? If you open the table in Design View, what is the field's Data Type?
 

sdawilson

New member
Local time
Today, 12:29
Joined
Feb 20, 2022
Messages
6
It's an Ole object. I'm trying to set a vba object to "content", rather than the field object. I've searched all over for the answer and can't seem to find a solution that doesn't require the object to be read from a control on a form.

I hoped that something like this would work:

Set XLWorksbook = rs(Ole_field).object

Sadly not.
 

Users who are viewing this thread

Top Bottom