E
enginerd477
I am trying to open documents in multiple programs (word, excel, pdf's)
that are all in one folder. I can get each one to open with a button
by going in and changing the suffix in my code to the proper one but i
can't get both or even one to open by itself when i ask the computer to
search for mulptiple files. I have a feeling what i did is not allowed
and thats why i keep getting my error message, here it is:
Private Sub Open_Report_Click()
On Error GoTo Err_Open_Report_Click
Dim filename As String
If filename = "\\averill\public$\Engineering\Part_Database\" &
CStr(Me!Report) & ".doc" Then
Application.FollowHyperlink filename
If filename = "\\averill\public$\Engineering\Part_Database\" &
CStr(Me!Report) & ".JPG" Then
Application.FollowHyperlink filename
Else
MsgBox "No File for this Report Exists!"
End If
EXit_Open_Report_Click:
Exit Sub
Err_Open_Report_Click:
MsgBox "There are no files linked to this Report Number"
Resume EXit_Open_Report_Click
End Sub
I know theres a way to create an array which will cycle through the
folder looking for matching titles but i don't know how to do it. the
Me!Report relates to the control source i am using, because each file
in the folder is related to the corresponding number generated by
access.
thanks in advance for any help.
that are all in one folder. I can get each one to open with a button
by going in and changing the suffix in my code to the proper one but i
can't get both or even one to open by itself when i ask the computer to
search for mulptiple files. I have a feeling what i did is not allowed
and thats why i keep getting my error message, here it is:
Private Sub Open_Report_Click()
On Error GoTo Err_Open_Report_Click
Dim filename As String
If filename = "\\averill\public$\Engineering\Part_Database\" &
CStr(Me!Report) & ".doc" Then
Application.FollowHyperlink filename
If filename = "\\averill\public$\Engineering\Part_Database\" &
CStr(Me!Report) & ".JPG" Then
Application.FollowHyperlink filename
Else
MsgBox "No File for this Report Exists!"
End If
EXit_Open_Report_Click:
Exit Sub
Err_Open_Report_Click:
MsgBox "There are no files linked to this Report Number"
Resume EXit_Open_Report_Click
End Sub
I know theres a way to create an array which will cycle through the
folder looking for matching titles but i don't know how to do it. the
Me!Report relates to the control source i am using, because each file
in the folder is related to the corresponding number generated by
access.
thanks in advance for any help.