Add hyperlink on Microsoft Access Form

I have a form where the users enters customer contract information.  I would like to add the feature for the user to attach the actual contract to the record in the form.  It only needs to be a hyperlink to the file address.  I know how to do this in design mode, but how can I set it up so that the user can attach the link themselves (without manually typing in the address).

Who is Participating?
Do not define this as a hyperlink data type.  Use Short Text as the data type in the table.  To open the document, use the FollowHyperlink method.  If you want the control to "look" like a hyperlink, set the display as hyperlink property of the control to yes.  I prefer to use double-click to activate the link.  If you use the click event, you will have trouble editing the value because the user will probably not realize that he has to tab into the control because if he clicks in, the code activates the hyperlink.
Rey Obrero (Capricorn1)Commented:
place this codes in a regular module

Function fSelectFile() As String
Dim fd As Object, strTitle As String
Set fd = Application.FileDialog(1)
With fd
    .AllowMultiSelect = False
    .ButtonName = "Select"
    .InitialView = 1
    .Title = "Select File"
    .Filters.Add "All Files", "*.*"
    If .Show Then
        fSelectFile = .SelectedItems(1)
    End If
End With
End Function

place a command button in your form, name it cmdGetFileLink
then use the codes in the click event of the button

private sub cmdGetFileLink_Click()

me.hyperlinktextboxName= fSelectFile()

end sub
Helen FeddemaCommented:
If the database is 2007 or higher, you could use the new Attachment field instead.  After adding the Attachment field to a table, place the field on a form (it will appear as an Attachment control).  All the user has to do is right-click on the control, then click the Add button in the Attachment dialog, and browse for the document to store in the field.

Add doc to Attachment field
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.