Application.Hyperlink question

  • Thread starter Thread starter Kurt
  • Start date Start date
K

Kurt

I have a subform (in datasheet view) where users can enter
a submission type (e.g., "application", "amendment") for a
study. I would like to give them the option of linking the
word they just typed to a Word document (e.g., the actual
application), so in the future they can just click on the
word and the linked document will open.

I presume that I should use Application.FollowHyperlink,
but how I can set things up so the user can select the
path to the stored document? An ideal interface would be a
file tree that pops up and allows the user to "browse" to
the file and then select it.

Here's some code I've come up with, but I'm not sure if
I'm on the right track:

Private Sub Submission_Click()
Dim strAppName As String
strAppName = 'the path
(e.g., "C:\StudyA\Application.doc" identified by the user
would go here
Application.FollowHyperlink strAppName
End Sub

Thanks. Kurt
 
On my website is a small sample database called "SetHyperlink" which
illustrates how to do this.
 
Kurt said:
I have a subform (in datasheet view) where users can enter
a submission type (e.g., "application", "amendment") for a
study. I would like to give them the option of linking the
word they just typed to a Word document (e.g., the actual
application), so in the future they can just click on the
word and the linked document will open.

I presume that I should use Application.FollowHyperlink,
but how I can set things up so the user can select the
path to the stored document? An ideal interface would be a
file tree that pops up and allows the user to "browse" to
the file and then select it.

Here's some code I've come up with, but I'm not sure if
I'm on the right track:

Private Sub Submission_Click()
Dim strAppName As String
strAppName = 'the path
(e.g., "C:\StudyA\Application.doc" identified by the user
would go here
Application.FollowHyperlink strAppName
End Sub

Thanks. Kurt

You'll find code to call the Windows File Open/Save dialog here:

www.mvps.org/access/api/api0001.htm
 
That's definitely the feature I'm looking for. However,
when I clicked on a new doc I entered in your form, it
treated it as a http:// link and opened up my browser.

(The same thing happened when I imported all the modules
and code into my own database. And I do have a DAO
reference checked.)

Any ideas? Thanks. Kurt
 
That's very strange. On my system it opens the document in the associated
application (Word, Excel, Notepad, etc). What file did you store and what
application is associated with the extension.
 
What file did you store and what
application is associated with the extension.

On your form, I entered a new doc called "Test." (All I
did was enter the word "Test.")

Then I clicked on Test, hoping to see the Windows File
Open/Save dialog appear, where I would have browsed to a
certain .doc (MS Word) file on my hard drive and selected
it, thereby establishing the link.

I sense that the double click event never had a chance to
execute, because the moment I click on the word "Test" it
begins the search for an http:// reference and opens the
browser. (Would changing the field type from hyperlink to
text resolve this?)

Kurt
 
Instead of typing anything in, just double-click on the empty field. It
will bring up the dialog box for you to browse to the file you want to
store. Thereafter, clicking on the link will open the application and the
document.
 
Back
Top