Automated Hyperlink (1 Viewer)

thecrunch

New member
Local time
Tomorrow, 00:54
Joined
Jun 21, 2019
Messages
7
Hello,

I have a table that has a calculated field named "Unique Sample Number". Each unique sample number has its own folder on the computer. There is a "Folder" field in the table which is a hyperlink field and when clicked it should open the folder for each individual sample.

I would like to create an automated hyperlink in the "Folder" field that is updated as new samples are added to the database.


I have tried to use a Before Change data macro to load the values needed. However, it is unfortunately not working.

The process I have tried is as follows:
SetField
Name = Folder
Value ="#S:\Technical Library" & [Unique sample number]" & "#"



Any help is appreciated!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:24
Joined
May 7, 2009
Messages
19,230
are you missing a "backslash"? also extra double quote in [unique sample number], to correct:

Value ="#S:\Technical Library\" & [Unique sample number] & "#"

the first part of the hyperlink is the text that will be displayed, next part is the actual location link.
to show unique number as displayed text:
Code:
Value =[Unique sample number] & "#S:\Technical Library[COLOR="Purple"]\[/COLOR]" & [Unique sample number] & "#"
 
Last edited:

thecrunch

New member
Local time
Tomorrow, 00:54
Joined
Jun 21, 2019
Messages
7
Thanks for the response arnelgp.
The missing backslash in my post was a typo.. The macro does not work with it.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:24
Joined
May 7, 2009
Messages
19,230
are you creating a separate macro.
use Data macro instead.
on your table Design View, click Create Data Macro.
choose Before Change from the listbox:
enter:
Code:
[B]SetField[/B]
Name:  [Folder]
Value: [Unique sample number] & "#S:\Technical Library\" & [Unique sample number] & "#"

save your table.
 

June7

AWF VIP
Local time
Today, 07:24
Joined
Mar 9, 2014
Messages
5,468
Or abandon the Hyperlink type field for options:

1. calculate hyperlink in textbox ControlSource:
=[Unique sample number] & "#S:\Technical Library\" & [Unique sample number] & "#"
and set property of IsHyperlink to Yes

2. use FollowHyperlink in VBA.
Followhyperlink("S:\Technical Library\" & [Unique sample number])

Then don't need Folder field.
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:24
Joined
Feb 19, 2002
Messages
43,257
1. Do not use the Hyperlink data type. It is not compatible with other RDBMS'
2. Store the hyperlink as text.
a. Use the Format property to make the text field look like a hyperlink.
b. in the dbl-click event, use the FollowHyperlink method to follow the link. This works for web pages, email addresses, and any local file whose extension is registered with Windows so that Windows knows which app to open.

PROBLEM - if the link field is not-editable, you can use the click event to follow the hyperlink so it works just like normal hyperlinks. However, if you want to edit the field on this form, you have to use dbl-click otherwise you will never be able to just click into the field to modify it. If you need to both edit and follow, the best option is probably to use two textboxes. One for data entry and the other for "follow". In the AfterUpdate event of the edit field, populate the unbound "follow" field. Also, in the Current event, populate the unbound "follow" field.
 

Users who are viewing this thread

Top Bottom