访问 - 超链接没有链接 [英] Access - Hyperlinks Aren't Linking
问题描述
我有一个用户创建函数表(见这里的功能:<一href="http://stackoverflow.com/questions/6203852/adding-a-file-browser-button-to-a-ms-access-form">Adding文件浏览器按钮到MS Access窗体)拉一个文件夹路径名到一个文本框。
I have a form with a user created function (See here for function: Adding a file browser button to a MS Access form) to pull a folder path name into a text box.
在理想情况下,我想这个文本成为可以从查询中打开一个超链接。然而,对于所有记录我从超链接无法正常工作的形式加入。我看着在编辑超链接的记载,也没有地址。另外,我已经手动输入一些记录之前,我做了的形式和他们的超链接工作得很好粘贴文件夹路径名进入细胞内,现在仍能正常工作。
Ideally, I want this text to become a hyperlink that can be opened from a query. However, for all records I have added from the form the hyperlink is not working. I looked in "Edit Hyperlink" for the records and there is no address. Also, I had manually entered some records in before I had made the form and their hyperlinks worked just fine by pasting the folder path name into the cell, and still work now.
我认为这个问题是,我使用返回纯字符串的函数,有没有办法把它改造成一个超链接的工作一旦在表中?
I think the issue is that the function I am using returns a plain string, is there any way to transform it into a working hyperlink once it is in the table?
推荐答案
粗略地说,一个功能接入超链接字段的值是一个字符串,其中包含#
字符超链接之间部分。 (请参阅访问的 Application.HyperlinkPart方法的帮助主题。)
Roughly speaking, a functional Access Hyperlink field value is a string which includes #
characters between the "hyperlink parts". (See Access' Application.HyperlinkPart Method help topic.)
例如,本使用DLookup
返回储存的值将显示为 AccessApps 的一个链接,该链接到我的 C: \用户\汉斯\ AccessApps 的文件夹。
For example, this DLookup
returns the stored value for a link which is displayed as AccessApps and which links to my C:\Users\hans\AccessApps folder.
? DLookup("url", "tblFoo", "id=1")
AccessApps#C:\Users\hans\AccessApps#
不过,如果我只存储其中包含的文件夹路径字符串...
However, if I store only the string which contains the folder path ...
CurrentDb.Execute "UPDATE tblFoo " & _
"SET url='C:\Users\hans\AccessApps' " & _
"WHERE id=4"
...的字符串中获取存储...
... the string does get stored ...
? DLookup("url", "tblFoo", "id=4")
C:\Users\hans\AccessApps
...但因为它不包括#
字符,Access不把它当作一个可点击的超链接。这只是其中的文字的看起来的像一个链接,但点击它什么都不做。
... but since it doesn't include #
characters, Access doesn't treat it as a clickable hyperlink. It's just text which looks like a link, but clicking it does nothing.
同时,似乎你正在使用名为 FolderSelection()
功能选择一个文件夹路径字符串。如果你想给函数的返回值存储为一个超链接,您可以包括#
字符之前和之后。
Meanwhile it seems you're using a function named FolderSelection()
to select a folder path string. If you want to store the function's return value as a hyperlink, you can include #
characters before and after.
"#" & FolderSelection() & "#"
如果你想要的文件夹路径为纽带,但它显示为别的,就把显示部分之前的第一个#
。
If you want the folder path as the link but have it displayed as something else, put the display part before the first #
.
"Click Me!#" & FolderSelection() & "#"
这篇关于访问 - 超链接没有链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!