Hyperlink question

McLaren

Board Regular
Joined
Jul 12, 2003
Messages
122
New to Access and am wondering how to go about doing this. I'm searching the help and the forums but haven't found my answer yet.

On my datasheet I have a column where you put in the name of a file, in this case F0045.TAP. What I would like to do is be able to doubleclick that cell and open up G:\Fadal\f0045.tap in the default program for that extension. How do I append "G:\Fadal\" to the link automatically without having the user fill the entire link in when they save the new record? I've made the column data type "hyperlink" but I"m not sure where to go from there.

Thanks in advance for any and all replies.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi, you can append some fixed characters to the front of the field name by doing the following :

Go into the form design, right click the 'file_link' field (or whatever you have called it) -> Properties -> Event Tab -> After Update -> Click the ... button to activate the Builder -> Code Builder -> Ok -> enter this (without the two outermost quotes) "[file_link] = "G:\Fadal\"&[file_link]" -> Save and close the VB window -> Save the form.

The code should look like this (before you close the VB window):
Private Sub file_link_AfterUpdate()
[file_link] = "G:\Fadal\"&[file_link]
End Sub

Please note that I used the field name 'file_link' and be sure to use your actual field name from your form.

BUT even though this appends the file location onto the front of the filename, I'm not sure it will work as you intended with the html format. I tried to open a file in this manner (i.e. using the html format link) and I kept getting error messages. Another member of MrExcel may know a way around that problem.

Andrew. :)
 
Upvote 0
Cool, thanks. I haven't made a form yet, because a couple guys prefer using the datasheet view, but perhaps I will have to do all of my manipulation from one.
 
Upvote 0
Any other thoughts for using the datasheet view? I've tried having three fields, first field being a default value of "G:\Fadal", a second field being user input of "F0045.TAP", and a third field being data type "hyperlink" with a default value attempting to concatenate them, but it's not working.
default value:
=[Location]&[Program Name]
error:
The database engine does not recognize either the field 'Location' in a validation expression, or the default value in the table 'Part Database'.
 
Upvote 0
Looks like this'll work.

Code:
Private Sub Program___Click()
LinkName = "\\fileserv\manufacturing\Fadal\" & Program__ & ".tap"
Application.FollowHyperlink LinkName, , True, False
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,888
Messages
6,162,623
Members
451,778
Latest member
ragananthony7911

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