TimTDP
asked on
Runtime error 490 Cannot open specified file
I have an Access 2000 database, residing on a network. The database consists of a front end and a separate back end.
I store pdf files on the same server that the back end resides
Using the code below, I can open the pdf files if I use the front end database on the server. However, if I try and open the pdf files from a workstation I get a Runtime error 490
Cannot open specified file.
how can I resolve this?
I store pdf files on the same server that the back end resides
Using the code below, I can open the pdf files if I use the front end database on the server. However, if I try and open the pdf files from a workstation I get a Runtime error 490
Cannot open specified file.
how can I resolve this?
FileToView = CurrentFolder & Me.cboSelectTaxYear & "\FiledInvoices\Tax Invoice " & Me.lstSelectInvoice.Column(1) & ".pdf"
If DoesFileExist(FileToView) = True Then
Application.FollowHyperlink FileToView
end if
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'd think that your file path is not correct; can you show us the code behind your "DoesFileExist" procedure, as well as the value of "FileToView" that you're passing to it?
ASKER
"Does file Exist"
"FileToView" - will pass on tomorrow. I need to get to a networked pc
"FileToView" - will pass on tomorrow. I need to get to a networked pc
Public Function DoesFileExist(ByVal strFileName As String) As Boolean
Set FSO = CreateObject("Scripting.FileSystemObject")
DoesFileExist = False
If FSO.FileExists(strFileName) Then
DoesFileExist = True
End If
End Function
How are you setting the value of "CurrentFolder" in your code.
FileToView = CurrentFolder & Me.cboSelectTaxYear & "\FiledInvoices\Tax Invoice " & Me.lstSelectInvoice.Column (1) & ".pdf
If this is in the form of "c:\folder" this would explain why it would work on your server but not on a workstation.
Leigh
FileToView = CurrentFolder & Me.cboSelectTaxYear & "\FiledInvoices\Tax Invoice " & Me.lstSelectInvoice.Column
If this is in the form of "c:\folder" this would explain why it would work on your server but not on a workstation.
Leigh
ASKER
On a workstation current folder is displayed as:
\\reception\database\
\\reception\database\
strDBPath = CurrentDb.Name
DataBaseName = Dir(strDBPath)
CurrentFolder = Left(strDBPath, InStr(strDBPath, DataBaseName) - 1)