Microsoft Access
--
Questions
--
Followers
Top Experts
I have a command on a form that use to work until Acrobat 8.0 was loaded. Â The below command was used to open an Adobe Reader file for the contract of the supplier selected by the user. Â Could you please look over the below code and tell me what needs to be changed? Â I noticed that the path to Adobe had changed, so I changed it to the following:
stAppName = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe  " & stFileName & ""
This change did open Adobe Reader, but it would not open the file. Â It gave me an error message stating: Â "There was an error opening this document. Â This file cannot be found." Â I have verified that the file is in the proper place and accessible. Â I even moved the file to my "C:\" drive and changed the path reference, and it still errored out. Â I'm thinking that there must be a change in how to reference the file to be opened, but I don't know what changed.
Any assistance you can provide in fixing this issue would greatly be appreciated.
Thank you.
Dave
Original Code:
__________________________
Private Sub cmdOpenAgreement_Click()
Dim stAppName As String
Dim stFileName As String
 stFileName = Forms!frm_main!txtAgreemen
 Â
 stAppName = "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe  " & stFileName & ""
 OpenApp = Shell(stAppName, 1)
 Â
End Sub
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
You have to get the *exact* Path, Name and extension of the file.
Do a search of "Adobe" on your machine.
Search through this list until you locate the Main Acrobat Reader Executable.
Right click this file and select: Properties
Copy the Exact Location and full file Name to your code as strFileName.
JeffCoachman
I have verified several times that I have the *exact* path. Â I took the file reference out of the statement, executed the command and Adobe Reader opened with no problems. Â It's only when I add the file reference that I'm getting the error.
I have also verified that the FILE reference is correct as well. Â I even moved the file to my hard drive and pointed to the new file address, but still getting error.
Im thinking that this has something to do with how the code is written. Â Is the file supposed to be referenced in a different way with the new Adobe version?
Thanks
Dave
Try this perhaps:
"C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe  " & "'" & stFileName & "'" & ""
JeffCoachman






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Still same result.
David
Make sure you completely uninstall Version 7.
Also try the 8.1 update.
8.1 supposedly addresses some "issues"
JeffCoachman
I now have version 8.1.2 installed and still no luck. Â I'm lost on this one...

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Then let's take the brute force approach.
What happens if you hardcode the FileName and path?
Private Sub cmdOpenAgreement_Click()
Dim varShell as Variant
  varShell = Shell("C:\Program Files\Adobe\Acrobat 8.1.2\Reader\AcroRd32.exe  c:\YourPDFFile.pdf", 1)
End Sub
JeffCoachman
Thank you for hanging in there with me on this one.
First let me state that I do not control the addition or removal of applications. Â I have to assume that our IT department has pushed the installation correctly to my system.
I moved the pdf file to my hard drive and kept one with the original name PP-PH9TEV01 Teva.pdf and the other as TestFile.pdf as indicated below.
varShell = Shell("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe  c:\PP-PH9TEV01 Teva.pdf", 1)
          Â
varShell = Shell("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe  c:\TestFile.pdf", 1)
When I run the code using the file name TestFile, the code executes correctly and displays the pdf file.
When I run the code using the file name PP-PH9TEV01 Teva.pdf, I get an error stating that the file can not be located.
Dont ask me why&..  but I had a hunch that the space between TEV01 and Teva.pdf in the original file name was creating the problem, so I removed the space in the file name and change my code and the code executed correctly.  It would appear that Adobe is having difficulty in handling the space in file names.
As stated before, Prior to the Adobe update, my original code had no difficulty opening the file (with spaces in the name), so Im not sure why all of a sudden they are having problems now.
Any thoughts on this?
Thanks again for your help.
My only guess would be that they had a lot of problems where people could not figure out when and where to use the Double quotes, so they just dropped support for names with spaces.
Very few commercial applications genereate files with spaces in the names anyway.
So now if you insert the "No space" filename into the string variable, does it work?
JeffCoachman






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
It works with "No space" in the file name. Â However, I don't control the file naming, so I'm still back where I started. Â Seems so simple to have file names with no spacing as part of the solution. Â Corp red tape will surely keep this one a miss for several months.
If you don't have any other suggestion, I lable this one as "busted" and move on.
Thank you.
We could Copy/Rename the files on demand.
Interested?
JeffCoachman
Great suggestion!!! Â That may work as file sizes are not that large. Â Please tell me how.
Thank you.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Microsoft Access
--
Questions
--
Followers
Top Experts
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.