Adding a hyperlink to a Form

Softweb

Registered User.
Local time
Today, 15:17
Joined
Feb 12, 2017
Messages
18
Hi. I am trying to add an unbound textbox to an Access Form to create a hyperlink that opens a folder located outside the Database. The following code provided as a solution to another member's problem. On adding a textbox to my form and trying the code, I found it opens the file explorer ok, but I want to open a particular folder. Somehow I need to include the file path to my folder, rather than "explorer ". Grateful for any help with this. Chris
[FONT=&quot]Private Sub txtAudit_files_DblClick(Cancel As Integer)[/FONT]
[FONT=&quot] Shell "explorer " & Me.txtAudit_files, vbNormalFocus[/FONT]
[FONT=&quot]End Sub[/FONT]
 
You can use FollowHyperlink instead:

Private Sub txtAudit_files_DblClick(Cancel As Integer)
FollowHyperlink Me.txtAudit_files
End Sub
 
Thanks the quick reply and for that info.

The code crashes on "FollowHyperlink Me.txtAudit_files", so obviously I am doing something wrong.
The filepath to my folder is
D:\...............\.............\required folder, so where does this go? I have experimented with the textbox hyperlink properties, but with no success.
 
The code is taking the value of the textbox field.
Does that contain the folder path?
If so, does it have a trailing backslash? Edit if so or remove using code

If it's the full file path, you need to extract the folder from that using code

I always use Application.FollowHyperlink rather than the shorter version arnel gave.
No idea if that makes a difference
 
Hi ridders. That works fine, so adding "Application" makes the difference. Thanks again
 
Excellent.
I've seen arnelgp shorten it before now. Perhaps it works for him ???
 

Users who are viewing this thread

Back
Top Bottom