Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    linking to a document using a hyperlink (2003 SR2)

    Dear Loungers,

    Related to my last hyperlink query... having now got accurate hyperlink addresses I wanted to display the content in a form - it won't be edited there but in the word document itself. I have tried to use the OLE controls but I am obviously doing something wrong, I need to be able to specify that the file content to read is the value held in the hyperlink field. It happens that the hyperlink filed is in a sub form but I didn't think that should be a problem if i addressed it correctly. I have tried to set the Source Doc name equal to my sub form field holding the hyperlink (Forms!ProcessPane.PROC_DescDocument) something doesn't like this but I can't work out what. Should I be able to do this and how?

    Thank you............... liz

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: linking to a document using a hyperlink (2003 SR2)

    Since you already have a hyperlink field, the user can simply click the hyperlink to open the document, so there doesn't seem to be an urgent need to display the document on the form itself.

    If you still want to display the document in an OLE control, you'll have to extract the path+filename from the hyperlink field, since as you now know, it surrounds the hyperlink address with # characters. The expression to use would be

    Mid([ProcessPane]![PROC_DescDocument], InStr([ProcessPane]![PROC_DescDocument], "#") + 1, InStr(InStr([ProcessPane]![PROC_DescDocument], "#") + 1, [ProcessPane]![PROC_DescDocument], "#") - InStr([ProcessPane]![PROC_DescDocument], "#") - 1)

    assuming that ProcessPane is the name of the subform and PROC_DescDocument the name of the control bound to the hyperlink field.

  3. #3
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: linking to a document using a hyperlink (2003 SR2)

    Hans,

    Well not all users will edit the documents and some only need to read the description and as we are all lazy they don't want to have to click and open another document unecessarily.

    Your approach dawned on me and I have tried something like this but I am tring to used the Source Doc field in an unbound WorldOLE object. This can't be right since it moans that the syntax is wrong whatever I do with it. Where does this expression properly live?

    thank you................. liz

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: linking to a document using a hyperlink (2003 SR2)

    I still don't think it is a good idea. Dynamically updating an OLE field is slow; the user will have to wait while switching between records even if he or she isn't interested in the contents of the document. Clicking the hyperlink allows the user to view the document only if necessary.

    If you want to use an OLE field, you'll have to use code to populate it, more or less like this:

    Private Sub Form_Current()
    Dim p1 As Integer
    Dim p2 As Integer
    Dim strHyperlink As String
    On Error GoTo ErrHandler
    strHyperlink = Me.Doc
    p1 = InStr(strHyperlink, "#") + 1
    p2 = InStr(p1, strHyperlink, "#")
    Me.OLEFrame.SourceDoc = Mid(strHyperlink, p1, p2 - p1)
    Me.OLEFrame.Action = acOLECreateLink
    Exit Sub
    ErrHandler:
    End Sub

    where Doc is the name of the hyperlink field and OLEFrame is the name of the OLE control. The control will have to have Enabled = True and Locked = False, and you will have to ensure that the hyperlink path is absolute, not relative. In short, it's a major PITA.

  5. #5
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: linking to a document using a hyperlink (2003 SR2)

    Hans,

    I see how it shuold work, I'll try to suggest not as you advise but.. well we'll see. Anyway useful for me to see how

    thank you................... liz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •