Keller Waldron
Keller Waldron

Reputation: 25

How can I change Access hyperlinks with VBA?

I've done some extensive research and realize this is not an easy task.

I need to change many hyperlinks in different tables from P:\Library\Folder... to I:\Folder...

I think I can change the field type to long text, find and replace, change type back to hyperlink.

Upvotes: 1

Views: 2109

Answers (1)

June7
June7

Reputation: 21370

Table Find/Replace dialog will work on Hyperlink field if there is no DisplayText component in hyperlink string.

In either case, an SQL UPDATE action will work, like:

CurrentDb.Execute "UPDATE table SET field = Replace([field], 'P:\Library\', 'I:\')"

It is possible to have hyperlink functionality on form and report in ReportView without Hyperlink type field. Of course this will require alternate method than hyperlink field interface to enter file path into text field - probably with VBA executing File System Object dialog. Hyperlink click will not be possible in table but since users should not interact with tables and queries, just forms and reports, this should not be an issue.

Upvotes: 1

Related Questions