【问题标题】:Add hyperlink to textbox in Access Report将超链接添加到访问报告中的文本框
【发布时间】:2019-05-31 22:23:45
【问题描述】:
我有一个访问报告,我正在从 VBA 代码的报告中填充一个文本框。我需要一种方法来为文本框中的某些文本添加超链接,以便它看起来像下面这样,因此文本框中只有一个单词是超链接
This is text in textbox. We are filled with random facts about fun stuff,
and great <hyperlink>things</hyperlink>!!!
【问题讨论】:
标签:
vba
ms-access
report
ms-access-reports
【解决方案1】:
您有标签vba 和access-vba,所以我可以为您提供VBA 解决方案。如果您在报表中添加一个文本框,并将名称设置为textbox1,然后打开属性并更改Text Format = Rich Text,那么您可以在VBA 中使用HTML 来编写超链接。
现在打开 VBE 并在任何情况下(按钮单击、页面加载等) - 添加此语法
Dim url as String
url = "http://www.google.com"
Me.textbox1.SetFocus
Me.txtbox1.Text = "Text here for whatever now let's add the hyperlink " & _
"<a href = " & url & ">Hyperlink Text</a>!!!."
现在,当您在 Report View 中查看报告时,您为变量 url 输入的站点
将是来自Hyperlink Text上方文本的超链接