opening files from access

  • Thread starter Thread starter sam
  • Start date Start date
S

sam

I have a database where I store the location of files
eg

c:\1.doc
c:\temp\1.xls
f:\sys\public.pdf

How can I run these from access?

TIA
Sam
 
I don't have Access but in Excel there are 2 ways.

1) Try setting up a hyperlink.
2) You could use the Shell command, possibly in a macro.
For this you need to know the exe name that runs the file
of that type.

Sub OpenFile(ExeName as String, FileName as String)

Dim strPath As String
Dim rc As Long

'Join the exe name and file name together
'[i.e - "Notepad.exe c:\TextFile.txt"]
strPath = ExeName & " " & FileName

rc = Shell(strFile)

If rc = 0 Then
MsgBox "File didn't run"
End If

End Sub
 
Back
Top