Opening Documents Across A Network

G

Guest

Good Morning,

I entered code into the double click event of a text box that would open a
PDF file that had a corresponding name to the value in the text box. (ie you
double click on a text box with the number 7145 as its value and it opens a
PDF named 7145 in a folder)

The code worked fine until I attempted to open the document over the network.

So when the adress read, "C:\Scanned Docs\" &
[tblBOTracking_TransactionNumber] & ".pdf"

The file opened with no problem.

However, when I changed the addres to:

Application.FollowHyperlink "\\960wmdrp28\scanned docs\" &
[tblBOTracking_TransactionNumber] & ".pdf"

Acrobat opens for a split second and then immediately closes. I don't see
the document in the Acrobat viewer, but the bar at the top of the Acrobat
viewer is display the correct file name. (it is displaying 7145.pdf)

It seems as if it is finding the file correctly, but is closing for some
reason...but only when it is going across the network and not on the PC
itself. I dont know if it is the code or some setting on the shared folder.
Below is an example of the exact code for the event. Is there something
missing that is causing this to happen?

Private Sub tblBOTracking_TransactionNumber_DblClick(Cancel As Integer)
On Error GoTo Err_tblBOTracking_TransactionNumber_DblClick

Application.FollowHyperlink "\\960wmdrp28\scanned docs\" &
[tblBOTracking_TransactionNumber] & ".pdf"

Exit_tblBOTracking_TransactionNumber_DblClick:
Exit Sub

Err_tblBOTracking_TransactionNumber_DblClick:
MsgBox Err.Description
Resume Exit_tblBOTracking_TransactionNumber_DblClick

End Sub

I did physically map the network drive to my pc and when I manually open the
file, it opens just fine. The problem seems limited to when i attempt to
execute the code through access.

I would appreciate any help or suggestions.

TIA

Antonio
 
G

Guest

Good afternoon,

I ran into the same problem. You might want to try incorporating use of the
hyperlink data type syntax into your code. This worked for me.

hyperlink data type can have up to 4 parts, syntax:

display text#address#subaddress

display text is usually the file name; Address = complete file name
(including path)
subaddress: you can leave out or again put in the complete file name.

example.

Function OpenPDFHyperlink() As Boolean
Dim strHL As String

On Error GoTo Error_OpenPDFHyperlink
'hyperlink syntax:
strHL = "Access.pdf#C:\myFiles\Access.PDF#C:\myFiles\Access.PDF#"
Application.FollowHyperlink strHL, , True
OpenPDFHyperlink = True
Exit_OpenPDFHyperlink:
Exit Function
Error_OpenPDFHyperlink:
MsgBox Err & ": " & Err.Description
OpenPDFHyperlink = False
Resume Exit_OpenPDFHyperlink
End Function

Hope this helps,
Pat
 
G

Guest

Pat,

Thanks for the help. I am having trouble adapting the syntax when I tried to
use your example.

I get a compile error that says "Expected end of statement" after the first
display text entry. Here is what I got
Private Sub tblBOTracking_TransactionNumber_DblClick(Cancel As Integer)
Dim strHL As String

On Error GoTo Err_tblBOTracking_TransactionNumber_DblClick
'hyperlink syntax:
strHL = " &
[tblBOTracking_TransactionNumber]&".pdf#\\960wmdrp28\scanned docs\" &
[tblBOTracking_TransactionNumber] & ".pdf#\\960wmdrp28\scanned docs\" &
[tblBOTracking_TransactionNumber] & ".pdf#"
Application.FollowHyperlink strHL, , True
OpenPDFHyperlink = True

Exit_tblBOTracking_TransactionNumber_DblClick:
Exit Sub

Err_tblBOTracking_TransactionNumber_DblClick:
MsgBox Err.Description
Resume Exit_tblBOTracking_TransactionNumber_DblClick

End Sub

I appreciate the help

Antonio


Pat said:
Good afternoon,

I ran into the same problem. You might want to try incorporating use of the
hyperlink data type syntax into your code. This worked for me.

hyperlink data type can have up to 4 parts, syntax:

display text#address#subaddress

display text is usually the file name; Address = complete file name
(including path)
subaddress: you can leave out or again put in the complete file name.

example.

Function OpenPDFHyperlink() As Boolean
Dim strHL As String

On Error GoTo Error_OpenPDFHyperlink
'hyperlink syntax:
strHL = "Access.pdf#C:\myFiles\Access.PDF#C:\myFiles\Access.PDF#"
Application.FollowHyperlink strHL, , True
OpenPDFHyperlink = True
Exit_OpenPDFHyperlink:
Exit Function
Error_OpenPDFHyperlink:
MsgBox Err & ": " & Err.Description
OpenPDFHyperlink = False
Resume Exit_OpenPDFHyperlink
End Function

Hope this helps,
Pat


Antonio said:
Good Morning,

I entered code into the double click event of a text box that would open a
PDF file that had a corresponding name to the value in the text box. (ie you
double click on a text box with the number 7145 as its value and it opens a
PDF named 7145 in a folder)

The code worked fine until I attempted to open the document over the network.

So when the adress read, "C:\Scanned Docs\" &
[tblBOTracking_TransactionNumber] & ".pdf"

The file opened with no problem.

However, when I changed the addres to:

Application.FollowHyperlink "\\960wmdrp28\scanned docs\" &
[tblBOTracking_TransactionNumber] & ".pdf"

Acrobat opens for a split second and then immediately closes. I don't see
the document in the Acrobat viewer, but the bar at the top of the Acrobat
viewer is display the correct file name. (it is displaying 7145.pdf)

It seems as if it is finding the file correctly, but is closing for some
reason...but only when it is going across the network and not on the PC
itself. I dont know if it is the code or some setting on the shared folder.
Below is an example of the exact code for the event. Is there something
missing that is causing this to happen?

Private Sub tblBOTracking_TransactionNumber_DblClick(Cancel As Integer)
On Error GoTo Err_tblBOTracking_TransactionNumber_DblClick

Application.FollowHyperlink "\\960wmdrp28\scanned docs\" &
[tblBOTracking_TransactionNumber] & ".pdf"

Exit_tblBOTracking_TransactionNumber_DblClick:
Exit Sub

Err_tblBOTracking_TransactionNumber_DblClick:
MsgBox Err.Description
Resume Exit_tblBOTracking_TransactionNumber_DblClick

End Sub

I did physically map the network drive to my pc and when I manually open the
file, it opens just fine. The problem seems limited to when i attempt to
execute the code through access.

I would appreciate any help or suggestions.

TIA

Antonio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top