Solved

Hyperlinks - when they go bad?

Posted on 2014-02-06
7
188 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now