473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Updating Hyperlinks

I have been tasked with reviving an old database that stopped working
about 3 years ago :(

On one of the tabs is a list of links to other databases utilising the
Hyperlink feature of MS Access and one of the problems with this
database is that all these files moved to new locations when a big
server "move round" occured about a month ago.

Whenever i right click the button that opens the page and select "Edit
Hyperlink" i get a new form with the hyperlink on it and this is what
i update however when i click OK it does not save this change and
reverts back to the original Hyperlink.

So...
How when and why does it happen?

How do i update the hyperlinks without deleting the entire form and
starting from scratch using my own methods to create links to other
files.
Nov 13 '05 #1
1 4887
Hi Darryl,

I have done something similar lately, and have discovered that the best way
(IMHO) to update a hyperlink to a file is to do so in code, wher you can
append "#file://" to the beginning of the hyperlink data.

I was importing a bunch of files that were all in one directory, and had
pretty much completely automated this routine.I used Terry Kreft's
BrowseFolder function http://www.mvps.org/access/api/api0002.htm to select a
directory, then wrote the results of a Dir loop to a table that contained
the file names ("tblFileNames").

If you want (or need) to import these files on an individual basis rather
than importing the entire contents of a directory, you could use the File
Open/Save dialog box http://www.mvps.org/access/api/api0001.htm to select a
single file, then modify my code accordingly. If you need help with this,
reply here, and I or someone else will give you a hand.

Notes:
This code was also much longer originally, and performed a whole bunch of
other conversion operations as well.
I have trimmed it down here so that it should be much closer to what I think
you are looking for.
I should also mention that this was a mainform / subform thing. The command
buttons were on the mainform, and the file hyperlinks were displayed in the
subform.
This code hunts for ".XLS" files, but could be easily changed to something
else.
**************************************************
Private Sub cmdImportMergeXL_Click()

Dim MyDB As DAO.Database
Set MyDB = CurrentDb

Dim rstFiles As DAO.Recordset
Set rstFiles = MyDB.OpenRecordset("tblFileNames")

Dim MyDir As String
Dim MyFile As String
Dim MyPath As String
Dim FileSpec As String
Dim Msg As String

Dim intFC As Integer 'File Counter
intFC = 0

'Start by browsing for the drive/directory containing the XL files
'-----------------------------------------------------------------
MyDir = BrowseFolder("Find the directory containing the desired files")

FileSpec = MyDir & "\*.xls"
MyPath = MyDir & "\" & Dir(FileSpec)
MyFile = Dir(FileSpec)
'This section loops thru the files in the directory one at a time
'and adds the imported filenames to the table
'-----------------------------------------------------------------
Do While Len(MyFile) > 0

With rstFiles
.AddNew
!FilePath = "#file://" & MyPath & "#"
'This converts the filepath string to a hyperlink,
'which allows the user to open the XL file from a subform link

.Update
End With

MyFile = Dir 'Import the next XL file in the directory.

If Len(MyFile) > 0 Then
MyPath = MyDir & "\" & MyFile
End If
intFC = intFC + 1
Loop

Set rstFiles = Nothing
Set MyDB = Nothing

Msg = ""
Msg = Msg & intFC
Msg = Msg & " XL filenames have been imported."
MsgBox Msg

Me.Refresh 'Refreshes the subform that now contains the imported filenames.

End Sub
************************************************
You might also like to create some code that could (optionally )delete any
existing file paths from the table before appending these new ones.

****************************************
Private Sub cmdStartOver_Click()

Dim Msg As String
Dim CR As String
CR = vbCrLf

Msg = ""
Msg = Msg & "ARE YOU SURE that you want to erase everything?" & CR & CR
Msg = Msg & "This will delete all of the existing File Names from the
table... " & CR
Msg = Msg & "Which will mean having to re-import them."

If MsgBox(Msg, vbYesNo, "Confirm Deletion") = vbYes Then
Dim MyDB As DAO.Database
Set MyDB = CurrentDb

MyDB.Execute "DELETE tblFileNames.* FROM tblFileNames;", dbFailOnError
Me.Refresh

MsgBox ("ALL information has been succesfully deleted.")

Set MyDB = Nothing

End If
End Sub
****************************************

--
HTH,
Don
=============================
Use My*****@Telus.Net for e-mail
Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================

"Darryl Neale" <da****@allaboutgames.co.uk> wrote in message
news:bb**************************@posting.google.c om...
I have been tasked with reviving an old database that stopped working
about 3 years ago :(

On one of the tabs is a list of links to other databases utilising the
Hyperlink feature of MS Access and one of the problems with this
database is that all these files moved to new locations when a big
server "move round" occured about a month ago.

Whenever i right click the button that opens the page and select "Edit
Hyperlink" i get a new form with the hyperlink on it and this is what
i update however when i click OK it does not save this change and
reverts back to the original Hyperlink.

So...
How when and why does it happen?

How do i update the hyperlinks without deleting the entire form and
starting from scratch using my own methods to create links to other
files.

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Colleyville Alan | last post by:
I have an application that has an Access table that stores the locations of slides in a Powerpoint file. This used to work fine when there were about 4 files and 200 slides. The database would...
0
by: Tim | last post by:
Access 97: I have a table with a hyperlink field that I display on a form. I can click on the form field and the hyperlink activates correctly. However, if I try to activate the hyperlink using VB...
4
by: Seefor | last post by:
Hi, I want my text hyperlinks to have a dotted border underneath, so I did this which works fine: a, a:link, a:visited, a:hover, a:active { color: #000; text-decoration: none;
9
by: Viken Karaguesian | last post by:
Hello all, I'm making a calendar section in a website. Each month is its own page and navigated by Previous / Next links. I have it working now with standard hyperlinks, but I want to learn how...
1
by: jez123456 | last post by:
Hi Experts I have a working c# application that users can store files (.doc, .xls, ..bmp, etc) as binary data into an Access database. I now need to extend this to also store hyperlinks. ...
1
by: Janna | last post by:
Hello tech savvy gurus! I hope someone can help me! THE PROBLEM: "Cannot open specified file" when I click on a hyperlink in an Access database when it is located on our server. THE...
3
by: prinsipe | last post by:
Hi all, what i'm doing is showing/hiding hyperlinks depending on the hyperlink clicked. it is partially working. when i call step1, all hyperlinks are hidden. but then i call step2, single and...
4
by: Rob | last post by:
Hi, I have a master page that contains a table layout. The contentplaceholder is located in one of the table cells. With frames technology it was possible for hyperlinks to load the linked pages...
12
by: Frustratee | last post by:
Sorry guys, this is killing me. I have been fighting this issue for several weeks, to no avail. I am exporting the results of a query to an excel sheet, with one of the columns being from a field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.