Hyperlinks not working properly (1 Viewer)

BHWATT

New member
Local time
Today, 04:54
Joined
Oct 6, 2017
Messages
6
Hey everyone. I am creating a databse and I would like users to be able to attach hyperlinks to documents on a server. I wrote the code

Private Sub attachment_Click()
Dim dialog As FileDialog
Set dialog = Application.FileDialog(msoFileDialogFilePicker)
With dialog
.AllowMultiSelect = True
.Show
Me!txtpath.Value = Replace(.SelectedItems.Item(1), ":\", ":")
End With

End Sub

This brings up a dialog box and then you select the document it will put the path in a txtbox that I have changed to hyperlink. When I click on the path hyperlink it does not bring anything up. If I click in the end of the path put a space and hit enter then the hyperlink will become clickable. It almost seems like I need to enter something in the txt box and hit enter before the link will start working. Any idea why this is?
 

moke123

AWF VIP
Local time
Today, 07:54
Joined
Jan 11, 2013
Messages
3,849
I think you'll find that many experienced developers will avoid the hyperlink datatype. It is much simpler to just store the text path to the file and then use the onclick or ondoubleclick event to open the file with application.Followhyperlink method or shellexecute. take a look herehttp://access.mvps.org/access/api/api0018.htm
 

Users who are viewing this thread

Top Bottom