locked
Add a hyperlink address that refer to a file in network RRS feed

  • Question

  • I have an Access application with SQL as backend database. In this software I have a  form for getting the customers' order. Usually customers send files that we should work on it and prepare it for printing. Often this files are big and I don't want to  attach and insert them in SQL database, it makes the database very big and slow. I want to use hyperlink for as an alternative.

    I would like the operator have a button that can press it and browse the file location in network and server and save the path in the order form. 

    This solution can help our employees to be able to find the original file in network very quickly and without trouble.

    It is easy with an Access backend database. But I don't know how can I do it with a SQL database.

    Regards,


    Karim Vaziri Regards,

    Thursday, July 25, 2019 9:31 AM

Answers

  • To open the file that is stored in the text field: 
    put this code in the OnClick event of the field:


    Dim Afile as string
    Afile = Me.FieldNameHoldingTheString
    Application.followhyperlink AFile

    • Marked as answer by kvaziri Sunday, July 28, 2019 6:33 PM
    Friday, July 26, 2019 3:42 PM

All replies

  • Your strategy is exactly correct.  One puts the big files in a separate folder.  All you need is to put the path to the file into a table.  This does not change is the back end is an Access file versus an SQL Server - because the table is simply holding a text string.

    Everything else is performed by the Access front end.  Here is air code of a file dialog I used once:

    To put the string into a text box:

    Dim strfile As String

           With Application.FileDialog(1)

              If .Show Then

                  strfile = .SelectedItems(1)

              Else

                  MsgBox "No file selected", vbInformation

                  Exit Sub

              End If

          End With

    Me.FieldNameHoldingTheString = strfile

    Thursday, July 25, 2019 6:56 PM
  • Thank you for your reply. The solution worked well, the file path saved to table and appeared in the text box.

    Now I want to open the file location when the operator click the path. In properties of the text box I changed the "Is Hyperlink" to Yes, but when I click the hyperlinked path it doesn't open the file location. How can I open the saved file location?


    Karim Vaziri Regards,

    Friday, July 26, 2019 3:35 PM
  • To open the file that is stored in the text field: 
    put this code in the OnClick event of the field:


    Dim Afile as string
    Afile = Me.FieldNameHoldingTheString
    Application.followhyperlink AFile

    • Marked as answer by kvaziri Sunday, July 28, 2019 6:33 PM
    Friday, July 26, 2019 3:42 PM
  • How can I open the file location, not the file. For example, open a folder.

    Karim Vaziri Regards,

    Sunday, July 28, 2019 6:39 PM
  • did you try a path string that is just to the folder?....and does not include the file info in the string...
    Monday, July 29, 2019 2:10 PM
  • Dim DirLocation As Variant
    Dim DirDialog As Office.FileDialog
    ChDir CurrentProject.Path & "\"
    Set DirDialog = Application.FileDialog(msoFileDialogFolderPicker)
    With DirDialog
    .InitialFileName = "YOUR SAVED FILE LOCATION FOLDER"
    .ButtonName = "Directory"
    If .Show = True Then
        For Each DirLocation In .SelectedItems
            MsgBox DirLocation
        Next
    Else
        MsgBox ("ACTION CANCELLED.")
        Exit Function
    End If
    End With
    Monday, July 29, 2019 3:18 PM