Go Back   Access World Forums > Microsoft Access Discussion > Tables

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-30-2019, 09:51 PM   #1
thecrunch
Newly Registered User
 
Join Date: Jun 2019
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
thecrunch is on a distinguished road
Automated Hyperlink

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!

thecrunch is offline   Reply With Quote
Old 06-30-2019, 10:08 PM   #2
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,573
Thanks: 58
Thanked 2,427 Times in 2,327 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Automated Hyperlink

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\" & [Unique sample number] & "#"
__________________
"Never stop learning, because life never stops teaching"

Last edited by arnelgp; 06-30-2019 at 10:15 PM.
arnelgp is offline   Reply With Quote
Old 06-30-2019, 10:15 PM   #3
thecrunch
Newly Registered User
 
Join Date: Jun 2019
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
thecrunch is on a distinguished road
Re: Automated Hyperlink

Thanks for the response arnelgp.
The missing backslash in my post was a typo.. The macro does not work with it.

thecrunch is offline   Reply With Quote
Old 06-30-2019, 10:26 PM   #4
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,573
Thanks: 58
Thanked 2,427 Times in 2,327 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Automated Hyperlink

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:
SetField
Name:  [Folder]
Value: [Unique sample number] & "#S:\Technical Library\" & [Unique sample number] & "#"
save your table.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 06-30-2019, 11:12 PM   #5
June7
Newly Registered User
 
June7's Avatar
 
Join Date: Mar 2014
Posts: 2,028
Thanks: 0
Thanked 486 Times in 482 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: Automated Hyperlink

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.
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by June7; 06-30-2019 at 11:21 PM.
June7 is offline   Reply With Quote
Old 07-22-2019, 10:40 AM   #6
Pat Hartman
Super Moderator
 
Join Date: Feb 2002
Location: Stratford,Ct USA
Posts: 27,798
Thanks: 13
Thanked 1,505 Times in 1,431 Posts
Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all Pat Hartman is a name known to all
Re: Automated Hyperlink

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.

__________________
Bridge Players Still Know All the Tricks
Pat Hartman is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk Update of Hyperlink Text to Display, not hyperlink friedboudinball Modules & VBA 6 08-18-2015 07:19 AM
Automated backups Groundrush Windows 2 10-03-2012 02:46 AM
Question Automated Hyperlink field JJHaddock General 0 10-21-2009 08:13 AM
Even more automated? foxygrandma Modules & VBA 2 07-02-2008 07:45 AM
Automated form David Trickett Modules & VBA 1 11-27-2002 08:02 AM




All times are GMT -8. The time now is 12:20 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World