Solved

Hyperlinks - when they go bad?

Posted on 2014-02-06
7
198 Views
Last Modified: 2014-02-10
Basically I have two questions here:

sometimes my hyperlinks just stop working (haven't moved the files) - they just get a load of gobbledegook in them e.g. &&%% etc. Should I just recreate them? This is in Excel

If I have a hyperlink to files in a folder eg. Access and the folder is moved - is there any way to ensure the hyperlink moves with it...or do I have to recreate the links again. Thank you
0
Comment
Question by:agwalsh
  • 4
  • 2
7 Comments
 
LVL 6

Assisted Solution

by:Aditya Arora
Aditya Arora earned 100 total points
ID: 39838387
Hi,

question 2 you need to recreate link again.

thanks Aditya
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 400 total points
ID: 39838461
This is one of the reasons I don't use the hyperlink datatype in Access.  I generally save the filename and the filepath in separate fields in my Access database.  Then, I run a query that contatenates the two and validates whether the file still exists on that path, something like:

SELECT [FilePath] & [FileName] as FileFull, IsValidFile([FilePath] & [FileName])
FROM yourTable
WHERE [FilePath] & [FileName] is NOT NULL

Then function IsValidFile simply tests whether the file exists using the Dir() function:

Public Function IsValidFile(FullName as string)

    IsValidFile = (Len(Dir(FullName)) > 0)

End Function

Then you can present those files where the [FilePath]&[FileName] is not valid and allow the user to search along a different path, or select a different path and assign all files that were in the original path to the new path.
0
 

Author Comment

by:agwalsh
ID: 39838483
Hm, thanks for that. The scenario is that every year the IT people in the company do a "tidy up" which means they ask people to move folders etc..
So assuming the second step you mentioned there.." assign all files that were in the original path to the new path."...how would that be done? The users I am helping are not VBA savvy...so it would have to be very clear :-)
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 400 total points
ID: 39838512
I would actually probably build that "archiving" into the application.

1.  Create a form with a dropdown containing all of the distinct paths to which files are located.  This way they can select all of the records that are on that path.

RowSource = "SELECT DISTINCT [FilePath] FROM yourTable"

2.  Add a textbox for the new path.  You can use the filedialog object (search it here on EE) to get sample code for selecting the path (if you don't want them to type it in).

3.  Move button, would look to see whether the new path already exists.  If not, it would confirm you want to create it.  Then create a recordset containing all of the files that need to be moved to the new path (based on the [FilePath] value.  Loop through that recordset using the FileCopy statement to copy files from the oldpath to the new path.

4.  Before deleting the files from the current path, I would probably make another pass through that loop, making sure that all of the files were copied properly, and if so, would then update the [FilePath] for each file and delete the file from the existing path using the Kill statement.
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 400 total points
ID: 39838516
Forgot about that, but you could also use the Name statement to do that all in one operation.

Name [OldFilePathAndName], [NewFilePathAndName]

which would eliminate step #4.
0
 

Author Closing Comment

by:agwalsh
ID: 39846774
Thanks for that. Got me thinking in a whole different way..much appreciated.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39846932
glad I could help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question