• Attaching link to file (A2003)

    Author
    Topic
    #421574

    Hello All,
    I asked some time ago and can’t find the response….. I need to write some code to attach a file name inside my DB. For instance, the user creates a word doc with some information in it. There is a related record in the DB and I want something that allows the user to point to the file, upload it to the server to a set location and put a hyperlink in the db pointing to the file on the server. The end result being is that the user can then click the hyperlink and open the linked file if needed. Has anyone done anything like this before?

    Thanks,
    Mark

    Viewing 0 reply threads
    Author
    Replies
    • #958298

      If you have a hyperlink field in the table, the user can right-click the text box bound to the hyperlink field and select Hyperlink | Edit Hyperlink. If you perefer, you can put a command button next to the text box, with the following On Click code:

      Private Sub cmdLink_Click()
      Me.txtFile.SetFocus
      On Error Resume Next
      RunCommand acCmdInsertHyperlink
      End Sub

      where txtFile is the name of the text box and cmdLink the name of the command button.

      • #959290

        Thanks Hans,
        One other thing I need to do is upload a file from a fixed location on the user PC. Can I use some VB code to go find a file with a certain name and copy it to a network location? After that operation, I want to use the hyperlinking that I mentioned in the previous post.

        Thanks,
        Mark

        • #959299

          If the file is in a fixed location, you don’t need to find it, or have I misunderstood? You can use

          FileCopy “C:FolderFile.ext”, “ServerShareFolderFile.ext”

          to copy a file from the user’s C: drive to a network folder.

      • #998515

        Hans,

        I want to link more then one file to a record.
        So I created a file that will link to my main table with an ID
        Now I want to make a continious form that shows me all the links of a record.
        That is working…. but I like your solution for changing the hyperlink field by a button

        Is it possible to have a button next to hyperlinkfield?

        >>> OKAY I just sould have tried it before I started asking… it is just working the way you descriped it… great thanks

      • #998934

        It’s been a while since I looked into this. How do you execute a hyperlink from something like a command button? Or, is it possible to open a folder using a command button?

        Thanks,
        Mark

        • #998938

          The idea of a hyperlink is that the user only has to click it to execute ot. If you want to simulate this in code, you can use Application.FollowHyperlink, for example

          Application.FollowHyperlink “http://www.wopr.com”

          Of course, you can use a variable instead of a literal string.

          If you want to open a folder, you can use Shell to start an instance of Explorer.exe with the appropriate path.

    Viewing 0 reply threads
    Reply To: Attaching link to file (A2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: