none
Linking PDF files to an OLE object in a report RRS feed

  • Question

  • Hi,

    I have a basic test form that includes a field containing the location and name of a PDF file that I want to display in an OLE object on the form; I use the following form to display the PDF file as I scroll through the recordset:

    Private Sub Form_Current()

        Me.olePDF.SourceDoc = Me.sFilePath
        Me.olePDF.Action = acOLECreateLink

    End Sub

    This works perfectly on the form, however when I try to produce the same output on a report I get the following error:

    Run -time error '2771': The bound or unbound object frame you tried to edit doesn't contain an OLE object.

    I am sending the name of the OLE Source Doc to use via the .OpenArgs parameter, but the code is falling over at the acOLECreateLink line:

        

    Private Sub Report_Open(Cancel As Integer)

        Dim sFile As String
        sFile = Me.OpenArgs
        MsgBox sFile
        Me.sFilePath.Caption = sFile

        Me.olePDF.SourceDoc = sFile
        Me.olePDF.Action = acOLECreateLink

    End Sub

    Any help would be much appreciated!

    Liz


    Wednesday, October 25, 2017 1:20 PM

All replies

  • Hi Liz Scott,

    What's the OLE object? Is it a Bound Object frame or an UnBound Object Frame? Did you ever set other property of the Object? What's result of "Msgbox Me.olePDF.Action"?

    I tried to use a Bound/UnBound Object Frame as the ole Object to do the test in Access 2007/2010/2016, all of them failed to set Action for the Object Frame on the Report. However, they also failed to set the Action on the Form. I tried to print the Action, but get error. Did I missed anything?

    Could you share a simply database file and tell us what's version of your access so we could try to reproduce your issue? You could share the file via OneDrive and put link here.

    Thanks for understanding.

    Best Regards,

    Terry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, October 26, 2017 8:05 AM