# Can MS-Access auto-hyperlink words ala a Wiki?

**URL:** https://boards.straightdope.com/t/can-ms-access-auto-hyperlink-words-ala-a-wiki/453598
**Category:** Factual Questions
**Created:** [June 20, 2008, 3:37pm UTC](https://boards.straightdope.com/t/can-ms-access-auto-hyperlink-words-ala-a-wiki/453598 "2008-06-20T15:37:56Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Whack-a-Mole](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/whack-a-mole/32/141_2.png) [@Whack-a-Mole](https://boards.straightdope.com/u/Whack-a-Mole)
#### Post date: [June 20, 2008, 3:37pm UTC](https://boards.straightdope.com/t/can-ms-access-auto-hyperlink-words-ala-a-wiki/453598/1 "2008-06-20T15:37:56Z")

</div>

I have an Access database that includes some large(ish) text fields. In a Report I’d like Access to scan the text and hyperlink any word(s) that we have an entry for in another Table.

So say it says, “The Financial Services Authority (FSA) said that it could veto American efforts to impose regulation on the London oil market, as the City took center stage in an escalating row over the role of speculators in driving up the global price of crude oil.”

I’d like Access to output, "The [Financial Services Authority](http://www.fsa.gov.uk/) (FSA) said that it could veto American efforts to impose regulation on the London oil market, as the City took center stage in an escalating row over the role of speculators in driving up the global price of crude oil. " (note the hyperlink)

Is there any way to do this?

If the answer is too complex for here if someone could point me to a website that explains it or a Google search that will get me there I’d appreciate it (my Google-Fu is failing me on this particular problem).

---

<div class="post-metadata">

### Author: ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)
#### Post date: [June 20, 2008, 4:17pm UTC](https://boards.straightdope.com/t/can-ms-access-auto-hyperlink-words-ala-a-wiki/453598/2 "2008-06-20T16:17:34Z")

</div>

I’d be extremely surprised if this feature exists. Note that Wikipedia links are generated by users, not any program on their end.

---

<div class="post-metadata">

### Author: ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)
#### Post date: [June 20, 2008, 4:20pm UTC](https://boards.straightdope.com/t/can-ms-access-auto-hyperlink-words-ala-a-wiki/453598/3 "2008-06-20T16:20:57Z")

</div>

Hmm…I am not very good with Access but I am good with VBScript/ASP so maybe I can get you started?

I would do it something like this…

```auto

ReportText = ReportTable.TextField

For Each Row In PhrasesTable.GetRows()
        ReportText = Replace(ReportText, [Phrase], "<a href=" & & ">" & [Phrase] & "</a>"
MoveNext()
Loop

```

Oh man…it seems that I’ve been doing so much C# lately that I have completely lost my mind when it comes to VB. Does that help at all? The syntax is horrible but the general idea is there (Replace(string, original, new) IS a real VB function…)

---

<div class="post-metadata">

### Author: ![Whack-a-Mole](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/whack-a-mole/32/141_2.png) [@Whack-a-Mole](https://boards.straightdope.com/u/Whack-a-Mole)
#### Post date: [June 20, 2008, 5:25pm UTC](https://boards.straightdope.com/t/can-ms-access-auto-hyperlink-words-ala-a-wiki/453598/4 "2008-06-20T17:25:46Z")

</div>

[QUOTE=ZipperJJ]  
Oh man…it seems that I’ve been doing so much C# lately that I have completely lost my mind when it comes to VB. Does that help at all? The syntax is horrible but the general idea is there (Replace(string, original, new) IS a real VB function…)  
[/QUOTE]

I am not good enough at VB to know just looking at that if it’d work but it certainly helps as a starting place. Thanks!

---

<div class="post-metadata">

### Author: ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)
#### Post date: [June 20, 2008, 5:52pm UTC](https://boards.straightdope.com/t/can-ms-access-auto-hyperlink-words-ala-a-wiki/453598/5 "2008-06-20T17:52:47Z")

</div>

Yeah sorry about that.

Basically the idea is…

1. Get your text field (the one with the text you want to hyperlink) and set it into a variable.
2. Get a recordset that contains rows of all the possible phrases and their corresponding links (2 columns)
3. Loop through the recordset and, for each record, run Replace(TextField,Phrase,FormattedPhraseWithHyperlink) on your TextField variable.

Here’s the [W3Schools explanation of the Replace Function](http://www.w3schools.com/Vbscript/func_replace.asp). You can also learn a little more about VBScript from the links on the left.
