By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,991 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,991 IT Pros & Developers. It's quick & easy.

How to write link so remote user can open document?

P: n/a
I use hyperlinks in a subform datasheet to display locally saved documents
that are associated with individual database entries. A customer entry may
have a list of invoices in pdf format, for example:

invoice23.pdf
invoice24.pdf

The document name appears as a hyperlink in the datasheet. The document is
opened (by the associated application) when the hyperlink is clicked. The
problem is the database and all the documents are stored on the "Main"
computer, so only the user on the Main computer can open the hyperlinks.
When a user connects to the database from another PC on the LAN and attempts
to open the document via the hyperlink, an error is received: "Unable to
open..."

Is there a way to construct the hyperlink to allow other users (who connect
to the database over the LAN) to open the document (which is stored on the
local machine that runs the database)?

Here's what the hyperlinks currently look like:

OrderFrm.txt#file://C:\Documents and Settings\Administrator\My
Documents\customers\Hawthorne\OrderFrm.txt

I have code that creates this string and puts it in the table (when a
document is "linked" to a customer). I could modify it easily enough... I
tried this:

OrderFrm.txt#file://MACHINENAME:\Documents and Settings\Administrator\My
Documents\customers\Hawthorne\OrderFrm.txt

but no luck.

Is there a way to make this more robust - so if the database is moved to
another machine it would still work for all remote users?

Thanks in advance.
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Wed, 08 Sep 2004 05:11:41 GMT, "deko"
<ww*******************************@nospam.com> wrote:

The link should be to:
\\machinename\sharename\dir\subdir\filename.ext
This is accomplished by sharing a folder on the server. Check the
Windows help file if you are new to this concept.

-Tom.

I use hyperlinks in a subform datasheet to display locally saved documents
that are associated with individual database entries. A customer entry may
have a list of invoices in pdf format, for example:

invoice23.pdf
invoice24.pdf

The document name appears as a hyperlink in the datasheet. The document is
opened (by the associated application) when the hyperlink is clicked. The
problem is the database and all the documents are stored on the "Main"
computer, so only the user on the Main computer can open the hyperlinks.
When a user connects to the database from another PC on the LAN and attempts
to open the document via the hyperlink, an error is received: "Unable to
open..."

Is there a way to construct the hyperlink to allow other users (who connect
to the database over the LAN) to open the document (which is stored on the
local machine that runs the database)?

Here's what the hyperlinks currently look like:

OrderFrm.txt#file://C:\Documents and Settings\Administrator\My
Documents\customers\Hawthorne\OrderFrm.txt

I have code that creates this string and puts it in the table (when a
document is "linked" to a customer). I could modify it easily enough... I
tried this:

OrderFrm.txt#file://MACHINENAME:\Documents and Settings\Administrator\My
Documents\customers\Hawthorne\OrderFrm.txt

but no luck.

Is there a way to make this more robust - so if the database is moved to
another machine it would still work for all remote users?

Thanks in advance.


Nov 13 '05 #2

P: n/a
Use CurrentProject.Path and then go from there...
Nov 13 '05 #3

P: n/a
> Use CurrentProject.Path and then go from there...

hmmm... sounds interesting. I'll give it a shot and post back.
Nov 13 '05 #4

P: n/a
> Use CurrentProject.Path and then go from there...

CurrentProject.Path returns this:

\\Main\c$\Documents and Settings\Administrator\My Documents\Database

It seems to be working on both the local and remote machines if I use this
as the link in the table:

invoice23.pdf#file://Main\c$\Documents and Settings\Administrator\My
Documents\Database\Docs\invoice23.pdf

The only restriction, if I want to programmatically insert the link in the
table, is that the Docs directory must remain a subdirectory of Database.

Just curious: is the prefix "#file:" necessary? What does it mean? Why is
it there?

Thanks again for the help!
Nov 13 '05 #5

P: n/a
> The only restriction, if I want to programmatically insert the link in the
table, is that the Docs directory must remain a subdirectory of Database.


Found a way around that restriction:

strDt = Dir(varFile) 'display text
strDochost = Trim$(Environ("ComputerName"))
If Mid(strDocDir, 2, 1) Like ":" Then strLinkDir = Left(strDocDir, 1) &
_
"$" & Right(strDocDir, Len(strDocDir) - 2)
strHlk = strDt & "#file://" & strDochost & "\" & strLinkDir & "\" & strDt

seems to be working okay, except that when a remote user attempts to link a
document to a customer's entry, the link turns out like this:

\\REMOTEPC\C$\Documents and Settings\Administrator\My
Documents\Database\Docs\invoice23.pdf

instead of:

\\MAINPC\C$\Documents and Settings\Administrator\My
Documents\Database\Docs\invoice23.pdf

I think what I need is a way to get the host name of the machine on which
the dataase resides. will repost this as a new question.
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.