opening files from access

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
 
G

Guest

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
 

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