OLE bound obj frame not showing file icon



I have a situation where users need to refer to documents related to records
stored in the database (mostly Word docs and PDFs).

At the moment the documents are linked using OLE fields in a table and bound
object frames (BOFs) on an entry screen. They correctly display as icons,
with the file names below them.

I would like to move to storing the UNC paths of the files instead of OLE
fields, both to avoid bloating the database and because OLE fields are a
complete pain to deal with. Especially if you move the source files.

So the entry screen would instead load the bound object frames based on the
path names on Current(), instead of binding the BOFs to database fields.

I have gotten everything to work, except that when I link to files through
code neither the icon nor the file name appears -- only the text "Document".
The linked file can be activated as normal but it doesn't show the icon. And
if I change the display type to content, it does show the content. But I
want the icon, not the content.

When the link is bound to an OLE field, or when you manually link from the
Insert Object dialog, the icon DOES appear. But no other properties of the
BOF seem to have changed. Am I missing something?

Here is the code I was trying. Filespec is the name of the BOF control.
Filespecpath is the name of the field that contains the path to the file to
be linked to.

Dim f As New FileSystemObject
With Me.Filespec
If f.FileExists(Nz(Me.Filespecpath.value)) Then
.Visible = True
.SourceDoc = Me.Filespecpath.value
.Action = acOLECreateLink
.Action = acOLEUpdate

Any suggestions are most appreciated.



I found another way that does not use OLE at all -- I display the file names
in labels with hyperlinks. I highly recommend this to anyone in a similar
situation. Avoid OLE at all costs!

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