M
Mark Andrews
I have an Access2007 database and am storing paths to files in a table.
Example: a single customer might have 5 external files that are related to
the customer
I decide not to store the files themselves in the database in an attachment
field for various reasons.
Everything seems to work ok I just have one question:
To open the file (Note: I do not know what type of file will be in the
list), I am using this code:
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Function OpenDoc(ByVal DocFile As String) As Long
OpenDoc = ShellExecute(0&, vbNullString, DocFile, vbNullString,
vbNullString, vbNormalFocus)
End Function
Is this the best way to trigger files to open from Access? I tried a few
examples (word, excel, txt) and it seems to work.
I noticed Allen Browne has a function for opening a file from a hyperlink as
an alternate method.
Just looking for an expert opinion on the best method,
Thanks,
Mark
Example: a single customer might have 5 external files that are related to
the customer
I decide not to store the files themselves in the database in an attachment
field for various reasons.
Everything seems to work ok I just have one question:
To open the file (Note: I do not know what type of file will be in the
list), I am using this code:
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Function OpenDoc(ByVal DocFile As String) As Long
OpenDoc = ShellExecute(0&, vbNullString, DocFile, vbNullString,
vbNullString, vbNormalFocus)
End Function
Is this the best way to trigger files to open from Access? I tried a few
examples (word, excel, txt) and it seems to work.
I noticed Allen Browne has a function for opening a file from a hyperlink as
an alternate method.
Just looking for an expert opinion on the best method,
Thanks,
Mark