Below is the code I use to open a pdf file.
This works correctly but I need a little assistance. If the first file does not exist, I do not want to see the file not found error message and search for the second file. If the file does exist, I do not want to search for the second file.
Code:
1.)Dim stAppName As String 2.) Dim varFile As String 3.) Dim varFile2 As String 4.) 5.)If Right(Me.JobPlanFolder, 5) = "\.pdf" Then 6.) 7.)MsgBox "There is no Job Plan associated with this record." 8.) 9.)Else 10.) 11.)varFile = Me.JobPlanFolder 12.) 13.)stAppName = "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe " & varFile 14.) 15.)Call Shell(stAppName, 1) 16.) 17.)varFile2 = Me.JobPlanFolder2 18.) 19.)stAppName2 = "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe " & varFile2 20.) 21.) Call Shell(stAppName2, 1) 22.)End If
Comment