Link to home
Start Free TrialLog in
Avatar of TimTDP
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?
FileToView = CurrentFolder & Me.cboSelectTaxYear & "\FiledInvoices\Tax Invoice " & Me.lstSelectInvoice.Column(1) & ".pdf"
                
If DoesFileExist(FileToView) = True Then
      Application.FollowHyperlink FileToView
end if

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jifriz
Jifriz
Flag of Saudi Arabia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Scott McDaniel (EE MVE )
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?
Avatar of TimTDP
TimTDP

ASKER

"Does file Exist"
"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

Open in new window

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
Avatar of TimTDP

ASKER

On a workstation current folder is displayed as:
\\reception\database\
strDBPath = CurrentDb.Name
DataBaseName = Dir(strDBPath)
CurrentFolder = Left(strDBPath, InStr(strDBPath, DataBaseName) - 1)

Open in new window