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).

Thanks!
scs-contractsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
0
PatHartmanCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.