View Full Version : Change path of multiple hyperlinks


Hayley Baxter
07-22-2004, 08:57 AM
I have a database that contains many hyperlinks linking to various contracts, one of the users have moved the contracts into a different location.

Is there a quick way to re-establish the links without having to go into each one and do this?

Thanks
Hay

dan-cat
07-22-2004, 12:02 PM
I have a database that contains many hyperlinks linking to various contracts, one of the users have moved the contracts into a different location.

Is there a quick way to re-establish the links without having to go into each one and do this?

Thanks
Hay

Sounds like for each form in your db - you are going to have to loop through each command button, label, or image control vai the Forms Controls collection - check its hyperlink property and amend as appropriate.

How about:

Dim myForm As Form, myControl As Control
Dim myHyperlink As Hyperlink
Dim myNewHyperlink As String

myNewHyperlink = "http://www.access-programmers.co.uk"

For Each myForm In Forms

For Each myControl In myForm.Controls
If myControl.ControlType = acLabel Or myControl.ControlType = acImage or myControl.ControlType = acCommandbutton Then

Set myHyperlink = myControl.Hyperlink
If NOT myHyperlink.Address = myNewHyperlink Then
myHyperlink.Address = myNewHyperlink
End If
Set myHyperlink = nothing
End If
Next myControl
Next myForm
End Sub

or something like that :o