Hyperlink Run-Time Error

trock12

New Member
Joined
Dec 17, 2014
Messages
29
I'm using a button to open a network link to a corresponding record (each record has it's own unique hyperlink)

I'm using the following coding:

Private Sub BUTTON_Click()
If Me.[Link] = "" Then
MsgBox "Error: Reference path is blank", vbCritical
Else
FollowHyperlink Me.[Link]
End If
End Sub

[Link] being the name of the table column that contains the links.

The button is opening the file path with no problem, but it is also opening up an error message:
Run-time error 7971:
Microsoft Access cannot follow the hyperlink to: file path# file path#1

The error message is repeating the file path and adding a # and #1 on-these are not in the original link

So all I need to do, is get rid of the error message and it should be good.

Thank you!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I don't have much experience with hyperlinks in Access. The error doesn't make a lot of sense - I'd try to explore all the properties of the hyperlinks and check for anything unusual.

A possible workaround is:
Code:
Private Sub BUTTON_Click()

If Me.[Link] = "" Then
	MsgBox "Error: Reference path is blank", vbCritical
Else
	DoCmd.SetWarnings False
	FollowHyperlink Me.[Link]
	DoCmd.SetWarnings True
End If

End Sub

Note you could also use the code from below to see if it works better for you (a "new and improved" follow hyperlink method):
http://allenbrowne.com/func-GoHyperlink.html
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,704
Messages
6,161,390
Members
451,701
Latest member
ckrings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top